hapijs / log

hapi logging plugin
Other
6 stars 5 forks source link

Add a development mode #19

Open Nargonath opened 3 years ago

Nargonath commented 3 years ago

Support plan

Context

What problem are you trying to solve?

As discussed among TSC members, it would be nice to have a development mode for the logs. It would be false by default but once enabled it would print to stdout a bunch of useful information while developing:

All with a nice format. Perhaps if we even want to get fancy we could use chalk or something like that for pretty colors.

Do you have a new or modified API suggestion to solve the problem?

I suggest we had a new root field in the plugin registration options:

{
  dev: false
}

This field would be false by default. Another name for the field could be development if we prefer that.

geek commented 3 years ago

I think https://github.com/hapijs/log/pull/20 will address this request. You can run the new example and remove the level argument or change it to "debug" to see the request output. If you install pino-pretty you can run it like: node example/pinoLogger.js | pino-pretty --colorize and then you will see all of the output that you mentioned above in a colorized format.