"paul" cuteness was annoying me for this
This commit is contained in:
parent
fb1ed4f4ee
commit
193120a25f
2 changed files with 10 additions and 7 deletions
|
@ -69,7 +69,7 @@ streams at different levels**.
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
A `log.clone(...)` is provided to specialize a logger for a sub-component.
|
A **`log.clone(...)`** is provided to specialize a logger for a sub-component.
|
||||||
The following will have log records from "Wuzzle" instances use exactly the
|
The following will have log records from "Wuzzle" instances use exactly the
|
||||||
same config as its parent, plus include the "component" field.
|
same config as its parent, plus include the "component" field.
|
||||||
|
|
||||||
|
@ -90,6 +90,9 @@ same config as its parent, plus include the "component" field.
|
||||||
log.info("done with the wuzzle")
|
log.info("done with the wuzzle")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Future
|
# Future
|
||||||
|
|
||||||
See "TODO.md", but basically:
|
See "TODO.md", but basically:
|
||||||
|
|
|
@ -10,11 +10,11 @@
|
||||||
var LOG_VERSION = 0;
|
var LOG_VERSION = 0;
|
||||||
|
|
||||||
|
|
||||||
var paul = function paul(s) { // internal dev/debug logging
|
var xxx = function xxx(s) { // internal dev/debug logging
|
||||||
var args = ["PAUL: "+s].concat(Array.prototype.slice.call(arguments, 1));
|
var args = ["PAUL: "+s].concat(Array.prototype.slice.call(arguments, 1));
|
||||||
console.error.apply(this, args);
|
console.error.apply(this, args);
|
||||||
};
|
};
|
||||||
var paul = function paul() {}; // uncomment to turn of debug logging
|
var xxx = function xxx() {}; // uncomment to turn of debug logging
|
||||||
|
|
||||||
|
|
||||||
var os = require('os');
|
var os = require('os');
|
||||||
|
@ -210,7 +210,7 @@ function Logger(options) {
|
||||||
}
|
}
|
||||||
this.level = lowestLevel;
|
this.level = lowestLevel;
|
||||||
|
|
||||||
paul("Logger: ", self)
|
xxx("Logger: ", self)
|
||||||
|
|
||||||
// Automatic fields.
|
// Automatic fields.
|
||||||
if (!this.fields.hostname) {
|
if (!this.fields.hostname) {
|
||||||
|
@ -222,7 +222,7 @@ function Logger(options) {
|
||||||
//process.on('exit', function () {
|
//process.on('exit', function () {
|
||||||
// self.streams.forEach(function (s) {
|
// self.streams.forEach(function (s) {
|
||||||
// if (s.closeOnExit) {
|
// if (s.closeOnExit) {
|
||||||
// paul("closing stream s:", s);
|
// xxx("closing stream s:", s);
|
||||||
// s.stream.end();
|
// s.stream.end();
|
||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
|
@ -287,7 +287,7 @@ Logger.prototype._emit = function (rec) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
var level = obj.level = rec[2];
|
var level = obj.level = rec[2];
|
||||||
paul("Record:", rec)
|
xxx("Record:", rec)
|
||||||
obj.msg = format.apply(this, rec[3]);
|
obj.msg = format.apply(this, rec[3]);
|
||||||
if (!obj.time) {
|
if (!obj.time) {
|
||||||
obj.time = (new Date());
|
obj.time = (new Date());
|
||||||
|
@ -297,7 +297,7 @@ Logger.prototype._emit = function (rec) {
|
||||||
var str = JSON.stringify(obj) + '\n';
|
var str = JSON.stringify(obj) + '\n';
|
||||||
this.streams.forEach(function(s) {
|
this.streams.forEach(function(s) {
|
||||||
if (s.level <= level) {
|
if (s.level <= level) {
|
||||||
paul('writing log rec "%s" to "%s" stream (%d <= %d)', obj.msg, s.type,
|
xxx('writing log rec "%s" to "%s" stream (%d <= %d)', obj.msg, s.type,
|
||||||
s.level, level);
|
s.level, level);
|
||||||
s.stream.write(str);
|
s.stream.write(str);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue