diff options
author | sonots <sonots@gmail.com> | 2019-03-22 01:14:14 +0900 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2019-12-09 19:17:31 +0900 |
commit | 0aafc32995b935b6c46c8439a3e2da008cd683fc (patch) | |
tree | e672890608cb0a2f5a26855823e6f36de0c494c3 | |
parent | 22548195d59d8b5e421c586bec81615a0a1091bc (diff) | |
download | ruby-0aafc32995b935b6c46c8439a3e2da008cd683fc.tar.gz |
[ruby/logger] frozen_string_literal: true
https://github.com/ruby/logger/commit/a057eede7b
-rw-r--r-- | lib/logger.rb | 4 | ||||
-rw-r--r-- | lib/logger/errors.rb | 2 | ||||
-rw-r--r-- | lib/logger/formatter.rb | 9 | ||||
-rw-r--r-- | lib/logger/log_device.rb | 2 | ||||
-rw-r--r-- | lib/logger/period.rb | 2 | ||||
-rw-r--r-- | lib/logger/severity.rb | 2 |
6 files changed, 15 insertions, 6 deletions
diff --git a/lib/logger.rb b/lib/logger.rb index aff2ad4a81..46cc6cf776 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 8095acc9c8..e8925e14ac 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 13cb1a8390..206c35d9fa 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 5661f5ce14..fe7d54fb81 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 bb8cffc2f8..76a8c3b011 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 c8179cb017..b38afb7d22 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 |