-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
UTC Time #451
UTC Time #451
Conversation
…ver the type; we make it an enum for possible expansions of time abstractions that might make it into the C++ standard in the future (see Howard Hinnant's date/timezone library) or might be usefully-available from the OS at some point in time
…gabime, or a reflection of a refactor with some data member left behind?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
R_formatter should do HH:MM only
-
I am not sure what's the point in the lambda. Why not simple
if (ptime == pattern_time::local)
return details::os::localtime(log_clock::to_time_t(msg.time));
else
return details::os::gmtime(log_clock::to_time_t(msg.time));
-
Please change the
pattern_time
enum name topattern_time_type
-
Please change the
ptime
variable name totime_type
…ications outside of standard are probably unlikely anyhow) pattern_time -> pattern_time_type ptime variable name -> pattern_time variable name make sure four spaces used, not tabs
3 & 4. (Fixed) I was wondering what would be a good way to name them. Changing to pattern_time_type frees up the variable name pattern_time: done! |
This issue addresses #215 in the way @gabime stated he'd like it to be handled: with a simple flag that can be passed to
pattern_formatter
's constructor. It's a smaller, simpler solution that propagates its changes to the virtual functions_set_pattern
andset_pattern
inspdlog::logger
andspdlog::async_logger
.The implementation is made as an enumeration simply because there may be more efficient time abstractions that spdlog takes advantage of in the future: the enumeration allows for seamless transition to these while maintaining backwards compatibility by ensuring that all defaulted loggers and pattern formatters use
spdlog::pattern_time::local
by default.Anyone who has derived from
logger
andasync_logger
will have to change their code to handle the new parameter for the virtualset_pattern
call, but I believe this is a negligible burden in 100% of the cases where people have actually customizedspdlog
to this degree.I have not measured the impact of a switch statement, but have done my best to use my general knowledge to ensure it will remain more or less swift, especially in the default case.
Small question: did you mean to never initialize the member variable
_pattern
inspdlog::pattern_formatter
? It never gets initialized (and you never use it anywhere?). I would imagine it's accidentally an artifact of slowly changing the pattern formatter to work in a compiled form and actually no longer needing it, so I don't set it in my code, but I do set the_time
member variable. Shouldn't it be removed, if that's the case? If so, I will be happy to remove it in this branch.Let me know if you need anything else.