Open pputhran opened 8 years ago
@pputhran Please provide example code.
Hi,
I'm having issues trying to log with the error level. Here is the code (first example in the repo readme):
var bunyan = require('bunyan');
var bunyanLogentries = require('bunyan-logentries');
var logger = bunyan.createLogger({
name: "test",
streams: [{
level: 'error',
stream: bunyanLogentries.createStream({ token: "xxx" }),
type: 'raw'
}]
});
logger.info("info test");
logger.error("error test");
The first logger.info works flawlessly however the second, the logger.error throws the following exception:
events.js:154
throw er; // Unhandled 'error' event
^
Error: The log method was called with the unknown level "undefined".
I've tried to spot where it fails and I can see in the debugger (in le_node/lib/node_modules/logger.js) that in line 193 (it seems to be a babelized file):
logger.js:193 [ lvl, lvlName ] = this[$toLevel](lvl)
for the logger.info it returns [1, "info"], but for the logger.error it returns [undefined, undefined]. I can't say anymore as for some reason I can't watch $toLevel as the debugger says that is undefined.
I hope to be helpful, if you need that I try something please don't hesitate to ask.
Thanks in advance.
@bethnull can you please check if https://github.com/nemtsov/node-bunyan-logentries/pull/9 fixes your issue?
Hi!
Yes, it seems to work ;)
Thanks for your support.
Having the same issue.
Hello,
Trying to understanding how to use both "info" and "errors". If I set level => streams: [{level: 'info', I am not able to use logger.error function. Can you please how to log both info and errors