Browse Source

log worker ID

jomo 10 years ago
parent
commit
5533a3ef91
1 changed files with 2 additions and 1 deletions
  1. 2 1
      modules/logging.js

+ 2 - 1
modules/logging.js

@@ -1,3 +1,4 @@
+var cluster = require("cluster");
 var config = require("./config");
 
 var exp = {};
@@ -16,7 +17,7 @@ function split_args(args) {
 
 function log(level, args) {
   var time = new Date().toISOString();
-  console.log(time + ": " + level + ": " + split_args(args));
+  console.log(time + " " + (cluster.worker && cluster.worker.id || "M") + " " + level + ": " + split_args(args));
 }
 
 exp.log = function() {