pinojs/pino

Access to child object in logMethod

Open

#897 opened on Aug 18, 2020

View on GitHub
 (6 comments) (1 reaction) (0 assignees)JavaScript (13,157 stars) (839 forks)batch import
enhancementgood first issue

Description

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"}

Contributor guide