in loglevel
log.debug("test");
and
log.error("test");
will output the same, e.g.
test
test
What I really want is
DEBUG: test
ERROR: test
According to the documentation, You could write a simple plug-in to prefix all log messages with their method name.
var originalFactory = log.methodFactory;
log.methodFactory = function (methodName, logLevel, loggerName) {
var rawMethod = originalFactory(methodName, logLevel, loggerName);
return function (message) {
rawMethod(methodName.toUpperCase() + ": " + message);
};
};
// Be sure to call setLevel method in order to apply plugin
log.setLevel("warn");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With