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

Solution to fix #175: Mute log record emission through Environment Variables #176

Closed
wants to merge 2 commits into from

Conversation

marcellodesales
Copy link

This commit adds the function that initially fixes #175 by disabling the
record being emitted. Requirements are described in the issue #175.

  • modified: lib/bunyan.js
  • Adding a helper method to disable objects by properties
  • new file: test/log-env-disabled.test.js
  • Adding the disable test case by setting the environment var before loading
    the record.

This commit adds the function that initially fixes trentm#175 by disabling the
record being emitted. Requirements are described in the issue trentm#175.

*	modified:   lib/bunyan.js
- Adding a helper method to disable objects by properties

*	new file:   test/log-env-disabled.test.js
- Adding the disable test case by setting the environment var before loading
  the record.
…ect.properties notation

This will exercise the case of references using the dot notation for the fix trentm#175.

*	modified:   test/log-env-disabled.test.js
- Adding a new env variable
- Adding the test case using the object.
@marcellodesales marcellodesales changed the title Initial commit to fix #175 accompained by test cases. Solution to fix #175: Mute log record emission through Environment Variables Oct 21, 2014
@trentm
Copy link
Owner

trentm commented Feb 3, 2016

@marcellodesales My apologies for taking so long to respond (see #335 for
details on that).

While I can see the appeal of this feature, I don't think it belongs in
Bunyan core. I think it could work as a 3rd-party bunyan stream. I've add this
rough example to show how that could work:
https://github.com/trentm/node-bunyan/blob/master/examples/mute-by-envvars-stream.js

Some philosophy/opinion why I think this doesn't belong in core:

  • A library shouldn't specify output streams, nor the end-user exposed features
    (e.g. environment variable names) for an app using that library.
  • The top-level app should control exposed env vars.

@marcellodesales
Copy link
Author

@trentm The example provided is what I'm looking for... I completely agree that it should be a Stream developed by users! Thanks a lot!

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

Successfully merging this pull request may close these issues.

Mute log record emission through Environment Variables
2 participants