Closed gajus closed 7 years ago
So why doesn't foo(taskId)
have a line like log.info('(task: %s) some information', taskId)
?
That would require injecting logger instance to every utility function/ dependency in the library.
This sort of tight coupling is asking for a problem.
Anyway, I am closing this as I have decided to work on a fork/ logger of my own.
Pino is great. But I have strong opinions about how logger should be structured and these do not align with Pino at the moment.
I was just trying to get an understanding of the problem.
I'd advise against such an api cause it will result in a mutable instance. Then modules could modify your log parameters and mess up your log instance.
I'd advise against such an api cause it will result in a mutable instance. Then modules could modify your log parameters and mess up your log instance.
Yup, I agree. It is not something I'd recommend 99% of the time.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
This would be similar to
.child()
, e.g.This is handy when logs need to be associated with a certain parameter for a duration of the program execution (e.g. while executing a specific task) and there is no way to pass an instance of a logger to the dependent components.
e.g.