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

Error Object Serialisation doesn't work #862

Closed
khadija-zekraoui opened this issue Jun 13, 2020 · 10 comments
Closed

Error Object Serialisation doesn't work #862

khadija-zekraoui opened this issue Jun 13, 2020 · 10 comments

Comments

@khadija-zekraoui
Copy link

I'm just starting out using pino and I try to serialize error object but it doesn't work
this is the code I use:
const log = pino({ name: "pino", timestamp: pino.stdTimeFunctions.isoTime, level: "trace", serializers: { err: err => ({ type: err.type, message: err.message, stack: e.stack }) } })
Could you help me please?
Thanks

@mcollina
Copy link
Member

How are you passing in an error?

@khadija-zekraoui
Copy link
Author

I try to understand how pino works so I only write :
log.error(new Error('test'))

@mcollina
Copy link
Member

The serializers only works if you prefix your object { err } would call the err serializer.

@khadija-zekraoui
Copy link
Author

I see. In case of a real application how me can manage that as we don't have control of generated errores?

@mcollina
Copy link
Member

I don't understand, who is calling the logger then?

@khadija-zekraoui
Copy link
Author

I don't know how but in my application it logs also no explicite errores logs.
For example en my application I set
´´´ appState.reportingDatab.dni = stepContext.result; ```
which reportingDatab is undefined and it logs the error :
image

@mcollina
Copy link
Member

If you don't know when something is logged I can't really help :(. Study your code.

@khadija-zekraoui
Copy link
Author

Ok. Thanks for your help

@khadija-zekraoui
Copy link
Author

I'm trying to understand how pino works, I look for documentation on internet but I found it difficult to find one which explains how to implement pino with code examples. If you know some links to help me, Could you give them to me please

@github-actions
Copy link

github-actions bot commented Feb 5, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants