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

Introduce a createLevel call, document, add tests. #300

Closed
wants to merge 0 commits into from

Conversation

aahoughton
Copy link

This is a -- possibly stopgap -- solution to the need for levels beyond the default set. It's imperfect, but it's also self-contained and easy to understand.

Caveats:

  1. There's no way to dynamically add dtrace probes after-the-fact of logger creation, so there's no way to trace levels in loggers that were instantiated prior to the level creation
  2. I think this is completely safe in-re: Logger fields; we may be adding functions to the prototype left-and-right, but they'll be shadowed by the actual Logger instance, and we won't overwrite anything that exists
  3. I'm a little uncomfortable with all the hand-holding / don't-shoot-yourself-in-the-foot going on in the createLogger call, but it's certainly safer ...
  4. The documentation could be better. :/

.. thoughts?

@aahoughton
Copy link
Author

Let me add, I'll be happy to update the CLI tool to take mappings -- something like a '--level' arg that lets you (someone) do something like '--level "notice=35" --level "foo=46", etc. ... but only if there's a sense that this work is headed in the right direction.

@aahoughton
Copy link
Author

.. aaand I needed it anyway.

aahoughton pushed a commit to aahoughton/node-bunyan-syslog that referenced this pull request Sep 25, 2015
code is generic, though it's impossible to trigger it for new levels
(any predefined levels will work) without some changes to bunyan.
The test code necessarily depends on a version of bunyan that allows
new levels to be created, see
  trentm/node-bunyan#300
@ORESoftware
Copy link

+1

@siimon
Copy link

siimon commented Jan 7, 2016

any possibility to get this merged? would be nice to have custom levels!

@ScheerMT
Copy link

ScheerMT commented Feb 2, 2016

I like the usage for adding a new log level in this PR. Came looking to see if bunyan had this feature already and surprised it didn't.

What else is needed to get this landed? My use case would include using this to keep all logging in one place and keep my custom stream logic in one place for forarding on the log messages to an external db.

@aahoughton
Copy link
Author

@trentm anything I can do here to help? I'd like to stop depending on a forked repo. I'd be happy to get this based off the head of the tree, but are there other issues you'd like to see addressed?

@aahoughton
Copy link
Author

Closing, rebasing, etc.

@aahoughton
Copy link
Author

Migrated here, for anyone following along at home: #465

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.

5 participants