Hello guys. I'm currently making logger. And I was stuck with the question — where is the best place for initialize logger. At first placing logger in the module looks like a nice idea (its allows to use error hook to catch and log unhandled errors)... but:
Why module stars two times (at the building moment and after starting)?
So. What's is the best way to realise am I in building process or not? I find the some kind of stupid way — to hook two event, "build" and "end".
- And the last. What is the best place to create logger instance (the class, thats write logs to the file system)? It's looks like there is no way to get the logger instance in plugin if it was created in module. But I'd like to use shared instance for obvious reasons. May be not module?
<!--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/c2506">#c2506</a>)</em></sub></div>