pinojs/pino

Access to child object in logMethod

Aperta

#897 aperta il 18 ago 2020

 (6 commenti) (1 reazione) (0 assegnatari)JavaScript (839 fork)batch import
enhancementgood first issue

Metriche repository

Star
 (13.157 stelle)
Metriche merge PR
 (Merge medio 1h 28m) (1 PR mergiata in 30 g)

Descrizione

I was looking to access the child object, I want to make so that it prepends the message object.

Here I log what inputArgs contains inside hooks.logMethod

after having called logger.child({"featureName":"MY FEATURE"}

{ inputArgs: [ 'special' ] }
{"level":30,"time":1597765635449,"featureName":"MY FEATURE","message":"special"}

I am trying to make a function that will prepend that name to message, so it becomes

{"level":30,"time":1597765635449,"featureName":"MY FEATURE","message":"MY FEATURE: special"}

Guida contributor