Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please allow changing label/prefix/serviceContext in child loggers #533

Open
garyo opened this issue Sep 30, 2020 · 1 comment
Open

Please allow changing label/prefix/serviceContext in child loggers #533

garyo opened this issue Sep 30, 2020 · 1 comment
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.

Comments

@garyo
Copy link

garyo commented Sep 30, 2020

Winston allows setting up a main logger and then creating child loggers for logging in specific modules, contexts, etc.:

const myLogger = logger.child({service: 'myService') // sets Winston 'service' metadata item on all logs

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(); perhaps const 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.

@product-auto-label product-auto-label bot added the api: logging Issues related to the googleapis/nodejs-logging-winston API. label Sep 30, 2020
@bcoe bcoe added the type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. label Oct 1, 2020
@freelerobot freelerobot added the priority: p3 Desirable enhancement or fix. May not be included in next release. label Jun 11, 2021
@freelerobot freelerobot assigned simonz130 and unassigned freelerobot Jun 29, 2021
@simonz130 simonz130 assigned losalex and unassigned simonz130 Jan 26, 2022
@sbousamra
Copy link

any news on this or workarounds?

@losalex losalex removed their assignment Jul 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.
Projects
None yet
Development

No branches or pull requests

6 participants