-
Notifications
You must be signed in to change notification settings - Fork 151
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
Not displaying trace logs despite minimum trace level #455
Comments
Possibly there is a bug? const pino = require('pino');
const log = pino({});
log.info('pino.info');
log.trace('pino.trace');
log.warn('pino.warn')
Would you like to send a Pull Request to address this issue? Remember to add unit tests. |
Is this a const pino = require('pino');
const transport = pino.transport({
targets: [
{
level: 'trace',
target: 'pino-pretty',
},
{
level: 'trace',
target: 'pino/file',
destination: 1,
}
],
});
const log1 = pino({}, transport);
log1.fatal('log1.fatal');
log1.error('log1.error');
log1.warn('log1.warn');
log1.info('log1.info');
log1.debug('log1.debug');
log1.trace('log1.trace');
const log2 = pino({level: 'trace'}, transport);
log2.fatal('log2.fatal');
log2.error('log2.error');
log2.warn('log2.warn');
log2.info('log2.info');
log2.debug('log2.debug');
log2.trace('log2.trace'); Output may be a bit messy, but EDIT: Removing |
This worked for me, but I just noticed it doesn't work once you set a customLevel in your transport / log2 config. |
You have to tell `pino-pretty` about the custom level. From the command
line, -x; programmatically, the `customLevels` option, per the config docs
in the readme.
…On Mon, Nov 13, 2023, 08:12 AndreasGalster2 ***@***.***> wrote:
Is this a pino configuration issue?
const pino = require('pino');
const transport = pino.transport({
targets: [
{
level: 'trace',
target: 'pino-pretty',
},
{
level: 'trace',
target: 'pino/file',
destination: 1,
}
],});
const log1 = pino({}, transport);
log1.fatal('log1.fatal');log1.error('log1.error');log1.warn('log1.warn');log1.info('log1.info');log1.debug('log1.debug');log1.trace('log1.trace');
const log2 = pino({level: 'trace'}, transport);
log2.fatal('log2.fatal');log2.error('log2.error');log2.warn('log2.warn');log2.info('log2.info');log2.debug('log2.debug');log2.trace('log2.trace');
Output may be a bit messy, but log1 stops at INFO for both transports
while log2 goes all the way to TRACE.
EDIT: Removing level from the transports also stops an INFO. The point
being, pino configuration and pino-pretty configuration are different.
You must set both to the same level, it seems.
This worked for me, but I just noticed it doesn't work once you set a
customLevel in your transport / log2 config.
—
Reply to this email directly, view it on GitHub
<#455 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AASIV674R4S6EJQ6WHBHPFTYEIMFNAVCNFSM6AAAAAA4NQ6QYWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMBYGE2DCNRRGU>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
This MWE
Only outputs two lines instead of expected three. Is it some misconfiguration issue, why doesn't it also show the trace log?
The docs suggest that "level" property is a minimum inclusive level.
Output from provided example
EDIT:
Also, some details, the empty line in my output is not from
log.trace
, and when using a file transportit does include the trace line in
pino.log
file.The text was updated successfully, but these errors were encountered: