MarcSchaetz / vuejs3-logger

Provides customizable logging functionality for Vue.js. Compatible with Vue3.
MIT License
9 stars 4 forks source link

Logger in Vue Router #5

Open laygir opened 1 year ago

laygir commented 1 year ago

Hello 👋

Thank you very much for this fork, I have been using it's vue 2 versoin for years and when I saw this I was very happy to switch over to this package when switching to vue 3.

Now I am trying to get a hold of my logger instance in Vue Router and Pinia.

For Pinia, I am doing this:

const app = createApp(App);
const pinia = createPinia();

pinia.use(({ store }) => {
  store.$log = markRaw(app.config.globalProperties.$log);
});

app.use(pinia);
app.use(router);
app.use(logger);

app.mount('#app');

And it works nice, but for Vue Router, I couldn't figure out. What would you suggest I do?