Closed atinux closed 3 years ago
Hi @gkatsanos. As Daniel mentioned in https://github.com/nuxt/nuxt.js/issues/8712#issuecomment-770625561, it is up to reporters to concatenate args
into message (if we do pre-formatting, handling objects like Error
is impossible for a reporter that needs to for example format stacktrace)
Also docs is correct. Consola accepts message
/additional
for logObject that adds it to args array before passing to reporters.
You may use args.join(' ')
for a simple formatter in custom repoter.
Also docs is correct. Consola accepts message/additional for logObject that adds it to args array before passing to reporters.
aha, now I get it. : https://repl.it/@gkatsans/Consola-2#index.js
message
is a property that can be included in the object to be logged by consola, and anything within message
will be passed in the args
array.
If one wants a prop message
to be in the output, they need a custom reporter that will fish out the message from the args array and place it in the object directly or elsewhere.
If one wants a prop message to be in the output, they need a custom reporter that will fish out the message from the args array and place it in the object directly or elsewhere.
Precisely :) Consola is mostly like a console middleware with built-in reporters. Reporters can connect it to a real logging infra like winston or sentry etc
If one wants a prop message to be in the output, they need a custom reporter that will fish out the message from the args array and place it in the object directly or elsewhere.
Precisely :) Consola is mostly like a middleware with built-in reporters. Reporters can connect it to a real logging infra like winston or sentry etc
In that case I guess I need winston, or the datadog logging library
Reproduction link : https://repl.it/@gkatsans/Consola#index.js
The consola contrib repository doesnt seem to have a lot of activity in the issue tracker hence my posting here.
Reported in https://github.com/nuxt/nuxt.js/issues/8712