lib/logger/formatter.rb in logger-1.4.4 vs lib/logger/formatter.rb in logger-1.5.0
- old
+ new
@@ -1,11 +1,12 @@
# frozen_string_literal: true
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
def initialize
@datetime_format = nil
@@ -17,10 +18,10 @@
end
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)
case msg
when ::String