Please allow changing label/prefix/serviceContext in child loggers #533
Labels
api: logging
Issues related to the googleapis/nodejs-logging-winston API.
priority: p3
Desirable enhancement or fix. May not be included in next release.
type: feature request
‘Nice-to-have’ improvement, new feature or different behavior or design.
Winston allows setting up a main logger and then creating child loggers for logging in specific modules, contexts, etc.:
As far as I can see, there's no way to change LoggingWinston transport options such as label, prefix, or serviceContext when creating a child logger. It would be very useful to be able to do that.
I realize that these are transport options, so it would probably have to be a LoggingWinston factory method that the user would call rather than
logger.child()
; perhapsconst myLogger = LoggingWinston.createChild(logger, {serviceContext: {service: 'myService'}})
or something. That would find the LoggingWinston transport(s) used by that logger and clone them for the child.The text was updated successfully, but these errors were encountered: