summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsonots <sonots@gmail.com>2019-03-22 01:14:14 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2019-12-09 19:17:31 +0900
commit0aafc32995b935b6c46c8439a3e2da008cd683fc (patch)
treee672890608cb0a2f5a26855823e6f36de0c494c3
parent22548195d59d8b5e421c586bec81615a0a1091bc (diff)
[ruby/logger] frozen_string_literal: true
https://github.com/ruby/logger/commit/a057eede7b
-rw-r--r--lib/logger.rb4
-rw-r--r--lib/logger/errors.rb2
-rw-r--r--lib/logger/formatter.rb9
-rw-r--r--lib/logger/log_device.rb2
-rw-r--r--lib/logger/period.rb2
-rw-r--r--lib/logger/severity.rb2
6 files changed, 15 insertions, 6 deletions
diff --git a/lib/logger.rb b/lib/logger.rb
index aff2ad4a81d..46cc6cf7765 100644
--- a/lib/logger.rb
+++ b/lib/logger.rb
@@ -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'
diff --git a/lib/logger/errors.rb b/lib/logger/errors.rb
index 8095acc9c83..e8925e14acb 100644
--- a/lib/logger/errors.rb
+++ b/lib/logger/errors.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# not used after 1.2.7. just for compat.
class Logger
class Error < RuntimeError # :nodoc:
diff --git a/lib/logger/formatter.rb b/lib/logger/formatter.rb
index 13cb1a8390f..206c35d9fad 100644
--- a/lib/logger/formatter.rb
+++ b/lib/logger/formatter.rb
@@ -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
diff --git a/lib/logger/log_device.rb b/lib/logger/log_device.rb
index 5661f5ce145..fe7d54fb811 100644
--- a/lib/logger/log_device.rb
+++ b/lib/logger/log_device.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require_relative 'period'
class Logger
diff --git a/lib/logger/period.rb b/lib/logger/period.rb
index bb8cffc2f8d..76a8c3b011b 100644
--- a/lib/logger/period.rb
+++ b/lib/logger/period.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class Logger
module Period
module_function
diff --git a/lib/logger/severity.rb b/lib/logger/severity.rb
index c8179cb017b..b38afb7d22a 100644
--- a/lib/logger/severity.rb
+++ b/lib/logger/severity.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class Logger
# Logging severity.
module Severity