-
Notifications
You must be signed in to change notification settings - Fork 182
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
Wrapped errors wrongly apply formatting #109
Comments
unfortunately workarounds dont work for us as they don't generate valid JSON (at least Datadog doesnt see it as such). |
can I over-write the built in reporters of nuxt core with a setting in the nuxt.config.js ? |
@gkatsanos You can set consola reporters in body of Also respectfully, please use channels like nuxt discord to get help for your solutions such as datadog integration. I would also be more than happy if can help there. Sending random questions in several repo/issues is wasting time. |
Issue fixed in v2.15.1 @gkatsanos You can get update with |
@pi0 I think I need to wait until its propagated to the main repo, right? https://github.com/nuxt/nuxt.js/releases |
@gkatsanos nop npm magic! (nuxt has range dependency on consola like |
@pi0 would you be available on the Vue Discord ? ( console.error ( { .. } ) still generates invalid JSON) |
@gkatsanos Sure pi0#6582 |
console.error when wrapped still adds ERROR in front of the object returned. reproduction: https://repl.it/@gkatsans/Consola-2#index.js |
It is intended indeed. Fancy reporter adds the badge. So you should either opt-out in nuxt or replace reporters |
Thanks. I can add a parser in Datadog that handles it but I guess going with the previous suggestion of consola.setReporters([
{
log: (e) => {
process.stdout.write(JSON.stringify(e))
},
},
]) in nuxt.config.js seems a more safe solution as I could also do further manipulation there centrally.. What do you think? (add a timestamp, structure the response etc) |
nuxt.config is safest place indeed (also please note consola should not be modified in other places. only use console.* calls) |
Using using
wrap*
helpers, we implicitly assume first argument as consola logObj format which might end with formatting errors. (nuxt/nuxt#8741)Reproduction
Workarounds
console.log(JSON.stringify(errorObj, null, 2))
console.log('', errorObj)
consola.restoreAll()
The text was updated successfully, but these errors were encountered: