Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using levels : info and error #7

Open
pputhran opened this issue Dec 15, 2015 · 5 comments
Open

Using levels : info and error #7

pputhran opened this issue Dec 15, 2015 · 5 comments

Comments

@pputhran
Copy link

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

@markstos
Copy link

markstos commented Mar 2, 2016

@pputhran Please provide example code.

@bethnull
Copy link

bethnull commented May 17, 2016

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.

@nemtsov
Copy link
Owner

nemtsov commented May 22, 2016

@bethnull can you please check if #9 fixes your issue?

@bethnull
Copy link

Hi!

Yes, it seems to work ;)

Thanks for your support.

@cbrwizard
Copy link

Having the same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants