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
Get access to children instances from parent #1534
Comments
We want the children to be lightweight and be able to create a new logger for each incoming and http request. Therefore tracking each children from the parent will be a memory leak. What you'd like to achieve could be done in an external module. I think https://github.com/pinojs/pino-arborsculpture does what you need. |
@mcollina Firstly, thanks for the quick response. About your point regarding memory leak, I understand the issue in implementing the original request as for some use cases it could actually be dangerous, but for my use case there is no risk of this. (All loggers are born and die on the service startup and shutdown). |
yeah, I'll be ok with an |
@mcollina Would it be feasible for pino to track all child instances internally using an iterable weakset implementation and transparently change the log level when the parent level is updated? |
That technique you are mentioning adds quite a bit of overhead in a hot path. |
@mcollina I have a PR I'm ready to push but missing access rights to push my branch, could you grant the needed permission? |
You should fork the repository (https://www.freecodecamp.org/news/how-to-fork-a-github-repository/) |
I am new to contributing to open source projects, so thank you for the explanation! |
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. |
Hey,
I am using
pino
in a big project containing multiple children. I want to be able to change the log level on all loggers at once.I saw there is another issue (#1330) about a similar scenario in which the answer was to create an array of loggers.
I would like to suggest to implement an array of children on a parent myself if you'd accept a PR regarding the subject.
The PR will:
children
array to theprototype
object here.Please let me know your thoughts and in hope you agree I will create a PR :)
The text was updated successfully, but these errors were encountered: