You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But I before getting into the details, I might try to defend the original design and let the layout fn handle the time format: how the time is rendered seems to be part of the layout to me. In the layout fn, the time could be converted to M/D/Y or UNIX timestamp etc.
Please let me know what's the benefit of detaching the time formatter function from the layout.
@daroczig
Thanks. I agree with you. I first tried make changes on layout functions.
However, I realized this approach is applicable to layout_* functions that generates the layout functions (e.g., layout_json)
Other layout_* functions are not customizable (e.g., layout_logging).
The another choice is to add an argument to log_layout.
However, this looks ugly because format_time semantically part of the layout, but is apart from the layout argument...
Also, it requires internal setter/getter function that treats the format function.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR enables formatting timestamp of logs by specifying functions to the following options
logger.format_timelogger.format_time.{namespace}(has priority)I actually wanted to achieve the feature without using options, but I find no suitable place to implement it...
Note that the behavior is not yet documented because I am not sure where to document it.
Do you have any ideas?
Some use cases are below