hapijs / hapi-pino

🌲 Hapi plugin for the Pino logger
MIT License
148 stars 61 forks source link

How to customize the log format? #110

Open iwilsonlee opened 4 years ago

iwilsonlee commented 4 years ago

Hi guys, How to customize the log format in this plugin? Now the log time format is the timestamp, and I want to convert it to the customize formatter, who can tell me how to do this? thanks for the help.

kungfutse commented 4 years ago

I haven't tried, but looking at the documentation, you might be able to do it using custom pino instance as I don't think you can set these options through the plugin registration: see https://github.com/pinojs/pino/blob/HEAD/docs/api.md#opt-timestamp and https://github.com/pinojs/pino/blob/HEAD/docs/api.md#pinostdtimefunctions-object

VirgileD commented 3 years ago

Yes, in fact you can, just put the pino option you need in the hapi-pino options. Hapi-pino options are given to pino as options there: https://github.com/pinojs/hapi-pino/blob/44cbdec76cb29df2d8e90a4efd35a206b7b02133/index.js#L51