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

Add level filtering option to stream #17

Closed

Conversation

willm
Copy link

@willm willm commented Feb 1, 2019

Fixes #16
Adds a level property to BunyanSlack constructor and ignores lower level errors if specified.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling efdd390 on willm:feature/control-level-via-stream into 21e1703 on qualitybath:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling efdd390 on willm:feature/control-level-via-stream into 21e1703 on qualitybath:master.

@tikotzky
Copy link
Member

tikotzky commented Feb 1, 2019

Hi,

Thanks for the PR. I'm just trying to understand your use case. Are you using bunyan with a single stream or multiple streams?

As far as I can tell in either case you should be able to specify the stream level using bunyan directly. For example...

const slackLogger = new BunyanSlack({
  webhook_url: 'mywebhookurl'
}),

// single stream
bunyan.createLogger({
    name: 'myapp',
    stream: slackLogger,
    level: 'info' // <-- log INFO and above to slack
});

// multiple streams
bunyan.createLogger({
  name: 'myapp',
  streams: [
    {
      level: 'info',
      stream: process.stdout  // log INFO and above to stdout
    },
    {
      level: 'error',
      stream: slackLogger     // log ERROR and above to slack
    }
  ]
});

Let me know if that is what you're looking to accomplish.

@willm
Copy link
Author

willm commented Feb 1, 2019

Hi @tikotzky I'm looking to achieve your multiple streams example. I see, I will try what you mentioned. Maybe I've misunderstood.

@willm willm closed this Feb 1, 2019
@tikotzky tikotzky mentioned this pull request Feb 1, 2019
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

Successfully merging this pull request may close these issues.

None yet

3 participants