-
Notifications
You must be signed in to change notification settings - Fork 61
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
Allow tags to point to a custom level defined in pino's customLevels #125
Conversation
…level defined in pino's customLevels instead of a hardcoded list
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
CI is failing |
Hm it seems completely unrelated to the changes (happens pre-PR too). Something internally in hapi's lib/request.js changed starting from v19 where doing server.inject with simulate close true like:
Throws an error at |
Can you send another PR that fixes those? I'm not really using this module and I'm not making a release with red CI. |
@mcollina this should be fixed now pulling in the merged #137 However, I'm not sure what's the deal now with the new pipelines. Fails my end with unrelated And it's waiting for approval here https://github.com/pinojs/hapi-pino/actions/runs/1317758243 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
@lauraseidler can you take a look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - not sure what went wrong with the tests there in the beginning, but looks fine now?
Ah I see - it's failing on your fork because that's a different repo and a different token.. not sure how to solve this rn, will take a look later. But as it's running fine on this repo, I guess it's okay for now. |
I published a new version 8.5.0 that includes these changes - thanks! |
You can define
customLevels
with pino, e.g.Meaning when logging with
logger.bar('hello world')
it results in{ level: 123, ... }
.hapi-pino
accepts an option oftags
, which is a map of hapi log tags to pino's level. However, the library has a hardcoded list of pino levels:It means you cannot define
tags
which would point to a custom level defined viacustomLevels
:Above throws an error
invalid tag levels
because it checks levelbar
against['trace', 'debug', 'info', 'warn', 'error']
.This PR compares
bar
againstObject.keys(logger.levels.values)
, which is the valid array of levels that pino accepts, including those defined viacustomLevels
.PR also adds a missing
fatal
level tolevelTags
object, fixingserver.log('fatal', 'bye world');
resulting inlevel: 30
/info
.