pinojs / pino-socket

🌲 A transport for sending pino logs to network sockets
43 stars 14 forks source link

Callback to manipulate the message before send? #85

Closed theogravity closed 2 years ago

theogravity commented 2 years ago

I think this could possibly used with the DataDog TCP log API. One thing that would be required would be that I would need to prepend the API key before a log message.

Having a callback such as onBeforeWriteMessage(msg: Buffer) with the return type being the message to send out (Buffer?) would allow me to do this kind of manipulation.

https://docs.datadoghq.com/logs/log_collection/?tab=tcp

theogravity commented 2 years ago

I can confirm it does work with datadog!

See https://github.com/pinojs/pino/issues/1511#issuecomment-1207472871 for example code