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

Avoid logging error while log-level is warn #12

Closed
iedmrc opened this issue Oct 19, 2020 · 3 comments
Closed

Avoid logging error while log-level is warn #12

iedmrc opened this issue Oct 19, 2020 · 3 comments

Comments

@iedmrc
Copy link

iedmrc commented Oct 19, 2020

Hi,
I need to send warning messages but not error messages to a Slack channel. How can/should I achieve this? I tried to send false in formatter (as suggested here: https://github.com/winstonjs/winston#filtering-info-objects) but it throws:

(node:11417) UnhandledPromiseRejectionWarning: Error: Request failed with status code 400

Thanks!

@TheAppleFreak
Copy link
Owner

Hmm, that's interesting. I'll check to see if there's something that this module needs to do that I'm not doing. Sorry for the inconvenience!

@daxadal
Copy link

daxadal commented Sep 27, 2021

I encountered the same casuistry, so I suggest a custom solution. The following functionalities have been added:

  • SlackHookOptions formatter can return false to filter out messages
  • SlackHookOptions formatter types updated
  • New test configuring SlackHook with a custom formatter that changes the output
  • New test configuring SlackHook with a custom formatter that filters out the message

Pull request: #14

@TheAppleFreak
Copy link
Owner

TheAppleFreak commented Oct 4, 2021

@_@

Sorry about the delay, life got weird for me! Merged #14, so this should be resolved now.

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

3 participants