             super(options)
             
             @options = options
-            @_opening = false
-            
-            @queued = []
+            
+            @_opening   = false
+            @_file      = null
+            @_queue = []
             
             process.addListener "SIGHUP", =>
                 # re-open our log file

                    # start appending
                    initFile = false
            
            @file = fs.createWriteStream @options.filename, flags:(if initFile then "w" else "r+")
            
            @file.once "open", (err) =>   
                console.log "w3c log open with ", err
                if initFile
                    # write our initial w3c lines
                    @file.write "#Software: StreamMachine\n#Version: 0.2.9\n#Fields: c-ip date time cs-uri-stem c-status cs(User-Agent) sc-bytes x-duration\n", "utf8", =>
                      @_opening = false
                      console.log "w3c open complete"
                      cb?(false)
                    
                @flush()
                            
        #----------
            
        close: (cb) ->
            @file?.end null, null, =>
              console.log "W3C log file closed."
            @file = null
            
        #----------
        
        flush: ->
            _u(@queued).each (l) => process.nextTick => @file.write(l)
            @queued.length = 0
            console.log "w3c finished flushing"
            @file.once "drain", => @emit "flush"
            
    #----------
    

            # unlike a normal logging endpoint, we only care about our request entries
            if level == @options.level                        
                # for a valid w3c log, level should == "request", meta.
                logline = "#{meta.ip} #{strftime(new Date(meta.time),"%F %T")} #{meta.path} 200 #{escape(meta.ua)} #{meta.bytes} #{meta.seconds}"
            
                @_queue.push logline
                @_runQueue()
        
        #----------
        
        _runQueue:  ->
            if @_file
                # we're open, so do a write...
                if @_queue.length > 0
                    line = @_queue.shift()
                    @_file.write line+"\n", "utf8", =>
                        @_runQueue if @_queue.length > 0
                
            else
                @open (err) => @_runQueue()
        
        #----------
        
