Permalink
Browse files

For trace logging levels, also record a backtrace.

  • Loading branch information...
1 parent 8dc0b39 commit 4da856d4f5d10bffdd2bdf83995467af0da2d713 @pquerna committed Jun 24, 2011
Showing with 13 additions and 2 deletions.
  1. +13 −2 lib/logmagic.js
View
@@ -68,8 +68,19 @@ var known_loggers = [];
var known_routes = [];
function buildLogMethod(modulename, level, callback) {
- return function (msg, extra) {
- callback(modulename, level, msg, extra)
+ if (level >= exports.TRACE1) {
+ return function (msg, extra) {
+ if (!extra) {
+ extra = {};
+ }
+ extra['full_message'] = new Error('Backtrace').stack;
+ callback(modulename, level, msg, extra)
+ }
+ }
+ else {
+ return function (msg, extra) {
+ callback(modulename, level, msg, extra)
+ }
}
}

0 comments on commit 4da856d

Please sign in to comment.