diff options
author | Hiroshi SHIBATA <[email protected]> | 2025-01-09 11:08:10 +0900 |
---|---|---|
committer | Hiroshi SHIBATA <[email protected]> | 2025-01-10 10:19:39 +0900 |
commit | cda268d8e99170f73c9c0c7dd2dbe9494ba89abb (patch) | |
tree | e4e08feb57f45f58008d4aa08a454f792a35f35c /lib/logger/formatter.rb | |
parent | b0d3771bce9dfcffb7467ea34971198cf4b4079e (diff) |
Make logger as bundled gems
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/12537
Diffstat (limited to 'lib/logger/formatter.rb')
-rw-r--r-- | lib/logger/formatter.rb | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/lib/logger/formatter.rb b/lib/logger/formatter.rb deleted file mode 100644 index c634dbf34d..0000000000 --- a/lib/logger/formatter.rb +++ /dev/null @@ -1,36 +0,0 @@ -# frozen_string_literal: true - -class Logger - # Default formatter for log messages. - class Formatter - Format = "%.1s, [%s #%d] %5s -- %s: %s\n" - DatetimeFormat = "%Y-%m-%dT%H:%M:%S.%6N" - - attr_accessor :datetime_format - - def initialize - @datetime_format = nil - end - - def call(severity, time, progname, msg) - sprintf(Format, severity, format_datetime(time), Process.pid, severity, progname, msg2str(msg)) - end - - private - - def format_datetime(time) - time.strftime(@datetime_format || DatetimeFormat) - end - - def msg2str(msg) - case msg - when ::String - msg - when ::Exception - "#{ msg.message } (#{ msg.class })\n#{ msg.backtrace.join("\n") if msg.backtrace }" - else - msg.inspect - end - end - end -end |