-
Notifications
You must be signed in to change notification settings - Fork 421
Feature request: Add property to logger class to return currently configured keys #3505
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
Comments
If ya'll like the idea I'll work up a sample implementation (may take a while due to the end-of-year holidays). |
great idea @gwlester - two quick thoughts without looking at the docs: 1/ need to think of alternative names, 2/ error handling needed as customers can bring their own log formatters from scratch (this might not be available). |
@heitorlessa , good points. Need to let my subconscious think on those for awhile. Don't expect code until sometime in Q1 of 2024. |
no rush at all ;) We're working on a big surprise to end the year well OR to start the year with a bang :) Appreciate your long-standing help in raising the bar on DX! |
Hi @gwlester! I'm looking into this issue and would like to know if you plan on submitting a PR soon. I think it will be a really good addition to the Logger utility, because as you said, knowing which keys have already been added helps prevent overwrites and other mistakes. Thanks. |
Hey @gwlester and @heitorlessa! I started working on a PR to include this property/method in our next release and I have some questions before moving forward with the PR. NameI can't think a better name than Property or method?Should it be a property or a method? A property can be cached, but I'm not sure if we can cache it since keys can change during runtime. I think this is more a matter of choosing between using @heitorlessa question
In our documentation, we recommend that customers implementing their own Formatter include Show keys and values or only keys?I'm not sure if we should expose keys and values. Customers may inadvertently expose sensitive data if we expose keys and values. On the other hand, I think customers would like to know the values of the keys so they can decide whether to replace them or not. What do you think? Remove the default keys?Should we consider not showing default keys like I'd love to hear your opinion on this PR @gwlester @heitorlessa. Thanks. |
@leandrodamascena, here is my take: Name Property or method? Show keys and values or only keys?
Remove the default keys? |
My vote is for a method too.
I believe you suggested creating a new method because when returning keys and values it is a
Agree Thanks |
Including a parameter on current_keys works for me. |
Thanks for your insights @gwlester! @heitorlessa will return from PTO on Tuesday and I look forward to hearing from him for any additional considerations. |
While writing tests for the new feature, I noticed that introducing |
|
This is now released under 2.37.0 version! |
Use case
For introspection code may want to see if an addition key has already been added to the logger before appending it since subsequent appends override the previous values.
Note -- it may be proper to add a similar property to the formatter classes.
Solution/User Experience
current_keys = logger.current_keys
Alternative solutions
Could "know" where the keys are stored in the formatter and directly access them -- that would be fragile.
Acknowledgment
The text was updated successfully, but these errors were encountered: