Skip to content
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

Changes to datetime formatting #60

Merged
merged 2 commits into from
Dec 9, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/logger/formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
class Logger
# Default formatter for log messages.
class Formatter
Format = "%s, [%s#%d] %5s -- %s: %s\n"
Format = "%s, [%s #%d] %5s -- %s: %s\n"
DatetimeFormat = "%Y-%m-%dT%H:%M:%S.%6N"

attr_accessor :datetime_format

Expand All @@ -19,7 +20,7 @@ def call(severity, time, progname, msg)
private

def format_datetime(time)
time.strftime(@datetime_format || "%Y-%m-%dT%H:%M:%S.%6N ")
time.strftime(@datetime_format || DatetimeFormat)
end

def msg2str(msg)
Expand Down