The goal of this PR is to allow the timestamps generated by the various layout classes to be represented in specific timezones. Currently only the system local timezone is used when generating timestamps. The changes in this PR allow the user to configure a utc_offset for timestamps. With this setting enabled, layouts will adjust times to the desired utc_offset before formatting the timestamp.
Logging.utc_offset = "UTC"
With the above configuration, all timestamps for all layouts will be formatted in the UTC timezone. The layouts themselves can override this default when they are first created.
Logging.utc_offset = "+01:00"
Logging.layouts.json(:utc_offset => "UTC") # times are formatted in UTC
Logging.layouts.pattern # times are formatted in Central European Time "+01:00"
The goal of this PR is to allow the timestamps generated by the various layout classes to be represented in specific timezones. Currently only the system local timezone is used when generating timestamps. The changes in this PR allow the user to configure a
utc_offset
for timestamps. With this setting enabled, layouts will adjust times to the desiredutc_offset
before formatting the timestamp.With the above configuration, all timestamps for all layouts will be formatted in the UTC timezone. The layouts themselves can override this default when they are first created.
fixes #156
/cc @andrewtran634 just FYI