feat: added 'LOGGER_TRANSPORT' env key#29
Conversation
ec36b99 to
2f835cb
Compare
| ...(process.env.LOGGER_TRANSPORT | ||
| ? { | ||
| transport: { | ||
| target: process.env.LOGGER_TRANSPORT |
There was a problem hiding this comment.
would be nice to have a default transport to pino-pretty if LOGGER_TRANSPORT is not defined
There was a problem hiding this comment.
If I'm not wrong, by default Pino uses stdout as the default transport (as per right now).
We are using a different transport in our source code because we are ingesting logs through OpenTelemetry (which could be considered a standard) as it prefers JSON format (similarly to datadog and other products).
I could change the code tomorrow to provide JSON as the default if you want.
Pino by default uses JSON as standard transport (if nothing is specified as in the changes I made).
In your current source code, you're forcing pino-pretty which is cool for console output but not useful when ingesting data through DataDog (or similar products).
I think providing a fallback value would make it impossible to "reset" the behavior to the default one.
As a mid-term improvements, there could be the possibility to specify loggerOptions (similarly to how payload does) on an init level
PR for issue #28
Added a new
LOGGER_TRANSPORTenv variable to easily setup pino loggerTransport propertyfyi: it seems the tests are failing (and it happens into master too)