kutuluk / loglevel-plugin-remote

A loglevel plugin for sending browser logs to a server
MIT License
102 stars 36 forks source link

logging Object becomes "[object Object]" #22

Open DaxChen opened 5 years ago

DaxChen commented 5 years ago

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 commented 5 years ago
log.warn('%o', { foo: 123 });

or

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