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

logging Object becomes "[object Object]" #22

Open
DaxChen opened this issue Jul 28, 2019 · 1 comment
Open

logging Object becomes "[object Object]" #22

DaxChen opened this issue Jul 28, 2019 · 1 comment

Comments

@DaxChen
Copy link

DaxChen commented Jul 28, 2019

when logging structured data, for example:

log.warn({ foo: 123 });

It shows as:

logs: [{message: "test warn [object Object]", level: "warn", logger: "",}]

console shows normal though.

Can you call JSON.stringify on either each argument or the whole args?
Or even let users define format function? (current format function gets "[object Object]" already...)

@kutuluk
Copy link
Owner

kutuluk commented Jul 29, 2019

log.warn('%o', { foo: 123 });

or

log.warn('%j', { foo: 123 });

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

No branches or pull requests

2 participants