Opened 9 years ago

Closed 7 years ago

#8839 closed Feature Requests (fixed)

Default timestamp format

Reported by: lcarreon@… Owned by: Andrey Semashev
Milestone: To Be Determined Component: log
Version: Boost 1.54.0 Severity: Cosmetic
Keywords: Cc:

Description

The default timestamp format should be:

%Y-%m-%d %H:%M:%S.%f

instead of:

%Y-%b-%d %H:%M:%S.%f

just in case a sorting of the log records according to timestamp is needed. (For example when log records get out of order due to threading.)

Change History (4)

comment:1 by Andrey Semashev, 9 years ago

What do you mean by "default timestamp format"? There is no default in log::expressions::format_date_time placeholder. If you format timestamps with the log::expressions::attr placeholder then formatting is performed by the regular operator<< for timestamps, which is provided by Boost.DateTime. I don't think it is reasonable to change that operator behavior.

comment:2 by lcarreon@…, 9 years ago

What I mean is when you use %TimeStamp% in a format string, it should format the timestamp using the format %y-%m-%d %M:%H:%S.%f.

comment:3 by Andrey Semashev, 9 years ago

When no formatter factory is registered for the "TimeStamp" attribute, the default factory will create a formatter similar to the log::expressions::attr placeholder. This is because the library has no knowledge of this attribute and does no special treatment. You have to register your own factory to change that.

I can try to change the default factory so that the generated formatter behaves differently for different types.

comment:4 by Andrey Semashev, 7 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.