vue-storefront icon indicating copy to clipboard operation
vue-storefront copied to clipboard

Logger improvements

Open sync-by-unito[bot] opened this issue 3 years ago • 0 comments
trafficstars

By default, debug messages are not shown in Nuxt (only info and higher), but adding DEBUG=* env variable fixed that. Following command adds DEBUG=* env variable, but excludes messages from namespaces that are irrelevant:

DEBUG=,-babel,-express:,-connect:,-send,-follow-redirects,-body-parser:,-babel:* yarn dev:ct

However, Server Middleware doesn’t use a logger created by the Nuxt.js plugin, so any configuration is ignored. This makes it impossible to log debug and info level messages.

We can replace the current logger implementation with a server-only logger like Winston. Currently, we use our logger only in a few places in the theme (and composables), and we could instead use console.xxx.

Using Winston would fix the above issues and provide a lot of new functionalities. For example, Winston provides Transports for logging to console and files, but custom or community-made integrations can be used to connect with various logging services.

sync-by-unito[bot] avatar Jan 24 '22 11:01 sync-by-unito[bot]