mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[ruby/logger] frozen_string_literal: true
https://github.com/ruby/logger/commit/a057eede7b
This commit is contained in:
parent
22548195d5
commit
0aafc32995
6 changed files with 15 additions and 6 deletions
|
@ -237,7 +237,7 @@ class Logger
|
|||
name = File.basename(__FILE__)
|
||||
end
|
||||
rev ||= "v#{VERSION}"
|
||||
ProgName = "#{name}/#{rev}".freeze
|
||||
ProgName = "#{name}/#{rev}"
|
||||
|
||||
include Severity
|
||||
|
||||
|
@ -574,7 +574,7 @@ class Logger
|
|||
private
|
||||
|
||||
# Severity label for logging (max 5 chars).
|
||||
SEV_LABEL = %w(DEBUG INFO WARN ERROR FATAL ANY).each(&:freeze).freeze
|
||||
SEV_LABEL = %w(DEBUG INFO WARN ERROR FATAL ANY).freeze
|
||||
|
||||
def format_severity(severity)
|
||||
SEV_LABEL[severity] || 'ANY'
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# not used after 1.2.7. just for compat.
|
||||
class Logger
|
||||
class Error < RuntimeError # :nodoc:
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Logger
|
||||
# Default formatter for log messages.
|
||||
class Formatter
|
||||
Format = "%s, [%s#%d] %5s -- %s: %s\n".freeze
|
||||
Format = "%s, [%s#%d] %5s -- %s: %s\n"
|
||||
|
||||
attr_accessor :datetime_format
|
||||
|
||||
|
@ -17,7 +19,7 @@ class Logger
|
|||
private
|
||||
|
||||
def format_datetime(time)
|
||||
time.strftime(@datetime_format || "%Y-%m-%dT%H:%M:%S.%6N ".freeze)
|
||||
time.strftime(@datetime_format || "%Y-%m-%dT%H:%M:%S.%6N ")
|
||||
end
|
||||
|
||||
def msg2str(msg)
|
||||
|
@ -25,8 +27,7 @@ class Logger
|
|||
when ::String
|
||||
msg
|
||||
when ::Exception
|
||||
"#{ msg.message } (#{ msg.class })\n" <<
|
||||
(msg.backtrace || []).join("\n")
|
||||
"#{ msg.message } (#{ msg.class })\n#{ (msg.backtrace || []).join("\n") }"
|
||||
else
|
||||
msg.inspect
|
||||
end
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require_relative 'period'
|
||||
|
||||
class Logger
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Logger
|
||||
module Period
|
||||
module_function
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Logger
|
||||
# Logging severity.
|
||||
module Severity
|
||||
|
|
Loading…
Reference in a new issue