Usage of npm i nuxt-pino-log is unclear from example

22 Views Asked by At

I am using typescript in a nuxt3 app and want to use the module npm i nuxt-pino-log which uses pino for logging. However it is not clear how to get a reference to the logger so that one can use it to log. The example uses middleware and defines a default export which I am assuming with only be executed prior to routing to a next page. Here is the project reference https://www.npmjs.com/package/nuxt-pino-log?activeTab=readme. Do I need a middleware folder as in the example? I do not understand the need for the middleware folder and what connection it has to using the logger in the pages. How can I use the logger by getting a reference to it using a type and then log with it? How can I use it to log in defineEventHandler for example? Can it be used in components in the components directory if I say, a component called Product.vue?

0

There are 0 best solutions below