Permalink
Browse files

initial work on logger

  • Loading branch information...
1 parent 01f4251 commit d40e9904af9c3ea9d7e68b1b257d3eda9809749b Karl Seguin committed Jan 16, 2012
Showing with 16 additions and 0 deletions.
  1. +1 −0 app.coffee
  2. +1 −0 lib/middleware.coffee
  3. +14 −0 lib/middleware/logger.coffee
View
@@ -10,6 +10,7 @@ store.initialize config.store, (err) ->
middleware = require('./lib/middleware')
server = connect()
.use(middleware.site())
+ .use(middleware.logger())
.use(middleware.context())
.use(connect.query())
.use(middleware.bodyParser())
@@ -1,5 +1,6 @@
module.exports =
site: require('./middleware/site')
+ logger: require('./middleware/logger')
context: require('./middleware/context')
app: require('./middleware/app')
bodyParser: require('./middleware/bodyParser')
@@ -0,0 +1,14 @@
+store = require('./../store').logStore
+
+logger = ->
+ logger = (request, response, next) ->
+ return next() if request._logger
+ request._logger = true
+
+ end = response.end
+ response.end = (chunk, encoding) ->
+ response.end = end
+ response.end(chunk, encoding)
+ next()
+
+module.exports = siteLoader

0 comments on commit d40e990

Please sign in to comment.