1
0
Fork 0
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:
sonots 2019-03-22 01:14:14 +09:00 committed by Hiroshi SHIBATA
parent 22548195d5
commit 0aafc32995
No known key found for this signature in database
GPG key ID: F9CF13417264FAC2
6 changed files with 15 additions and 6 deletions

View file

@ -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'

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
# not used after 1.2.7. just for compat.
class Logger
class Error < RuntimeError # :nodoc:

View file

@ -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

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
require_relative 'period'
class Logger

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Logger
module Period
module_function

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Logger
# Logging severity.
module Severity