Permalink
Browse files

Explain logging severities.

  • Loading branch information...
1 parent f77bb1e commit 94c5bdd8fc7910aeb870cef0d9750ac0abc0a886 @majek majek committed Oct 17, 2011
Showing with 9 additions and 4 deletions.
  1. +4 −1 README.md
  2. +5 −3 src/webjs.coffee
View
@@ -130,7 +130,10 @@ Where `options` is a hash which can contain:
<dd>It's quite useful, especially for debugging, to see some messages
printed by a SockJS-node library. This is done using this `log`
function, which is by default set to `console.log`. If this behaviour
-annoys you for some reason, override `log` setting with a custom handler.
+annoys you for some reason, override `log` setting with a custom
+handler. The following `severities` are used: `debug` (miscellaneous
+logs), `info` (requests logs), `error` (serious errors, consider
+filing an issue).
</dd>
<dt>heartbeat_delay (milliseconds)</dt>
View
@@ -109,7 +109,7 @@ exports.GenericApp = class GenericApp
res.writeHead(500, {})
res.end("500 - Internal Server Error")
catch y
- @log('Exception on "'+ req.method + ' ' + req.href + ''
+ @log('error', 'Exception on "'+ req.method + ' ' + req.href + ''
'" in filter "' + req.last_fun + '":\n' + (x.stack || x))
return true
@@ -187,7 +187,8 @@ exports.GenericApp = class GenericApp
when 'text/plain', ''
q = data
else
- @log("Unsupported content-type " + req.headers['content-type'])
+ @log('error', "Unsupported content-type " +
+ req.headers['content-type'])
q = undefined
next_filter(q)
throw {status:0}
@@ -202,7 +203,8 @@ exports.GenericApp = class GenericApp
when 'text/plain', 'T', 'application/json', 'application/xml', ''
q = data
else
- @log("Unsupported content-type " + req.headers['content-type'])
+ @log(error, "Unsupported content-type " +
+ req.headers['content-type'])
q = undefined
next_filter(q)
throw {status:0}

0 comments on commit 94c5bdd

Please sign in to comment.