Permalink
Browse files

Extracted handler (see prev commit

  • Loading branch information...
1 parent 6c7ab97 commit 36848db9e45797d1e4845d36bafe25ae8509c322 @showstopper committed Nov 6, 2011
Showing with 4 additions and 33 deletions.
  1. +0 −10 lib/Log.coffee
  2. +4 −23 lib/cyanide.coffee
View
10 lib/Log.coffee
@@ -1,10 +0,0 @@
-class Log
-
- @root = new Logger
-
- getLogger: (path) ->
- ###
- if path is ""
- @root
-
-
View
27 lib/cyanide.coffee
@@ -1,8 +1,8 @@
fs = require "fs"
+
+Handler = require "./Handler"
Logger = require "./Logger"
-stdout = fs.createWriteStream "/dev/stdout" # this is probably a stupid idea
-
class Log
@rootLogger: new Logger.Logger
@@ -16,26 +16,7 @@ class Log
@attachHandler: (handler) ->
Log.rootLogger.attachHandler handler
-class Handler
-
- handle: (logger, level, emitter, msg) ->
- formatted = msg
- @send(logger, level, emitter, msg, formatted) # why msg+formatted?
-
-
-class StreamHandler extends Handler
-
- send: (logger, level, emitter, msg, formatted) ->
- @stream.write formatted
- @stream.write "\n"
- @stream.flush()
-
-class StdoutHandler extends StreamHandler
-
- constructor: ->
- @stream = stdout
exports.Log = Log
-exports.Handler = Handler
-exports.StreamHandler = StreamHandler
-exports.StdoutHandler = StdoutHandler
+exports.StdoutHandler = Handler.StdoutHandler
+exports.StderrHandler = Handler.StderrHandler

0 comments on commit 36848db

Please sign in to comment.