APILogger for API request: APILogger.info('blabla'), APILogger.error('blabla'), this will save a document {level: 30, time: '', name: 'API', msg: 'blabla'} to mongodb
So far, I get what I need, save a document with a field named name, and value is API.
Question
Because webwork cannot share a mongodb connect cursor, so, if I have 10 different loggers, I should write 10 different transport, and keep 10 mongo connections? Is there any way to add the name field to the pino object before logger pipe all the transport?
Goal
add more than one logger for my project, like:
{level: 30, time: '', name: 'API', msg: 'blabla'}
to mongodbaka: I want a mongo version of name option: https://getpino.io/#/docs/api?id=name-string
Idea
Add one field to transport message is easy: 1, add a name filed in targets options
2, add name filed to the object for transport, like this: https://github.com/pinojs/pino-mongodb/blob/master/lib/log.js#L9-L14
So far, I get what I need, save a document with a field named name, and value is
API
.Question
Because webwork cannot share a mongodb connect cursor, so, if I have 10 different loggers, I should write 10 different transport, and keep 10 mongo connections? Is there any way to add the name field to the pino object before logger pipe all the transport?