Currently logging in nuxt is mostly implemented by calling a module/class specific Debug
instance directly. Are there plans to integrate a centralized logging facility?
Things I would like to be able to do are:
- Different log levels and/or levels of verbosity
In the case of nuxt-generate eg it would be nice if we would be able to only print statements from the generator class (normal mode), print statements from the render class (verbose mode) and print statements from hook calls (debug or very verbose mode)
- Append output to a file, with possibility to redirect warn / errors to a different file
- Custom prefixes unrelated to the module/class the log statement is generated in
- Have the logging/debug statements abstracted from the log facility implementation
Eg in
builder/generator.js
I removed the log statements and switched them to hook call's because for generate-cluster I wanted the log statement to include the worker id. But actually I think it would be better to not 'mis-use' hooks for this, one way to solve this is if you could just attach your own log method so you could prefix the log statement (eg by extending a default nuxt logging class?)
<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c2004">#c2004</a>)</em></sub></div>