summaryrefslogtreecommitdiff
path: root/lib/logger.rb
diff options
context:
space:
mode:
authornahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-09-20 02:51:06 +0000
committernahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-09-20 02:51:06 +0000
commitdeb2caf4b50e3736cde8460aec9064ee4c32668d (patch)
tree95f9564a8976a28ad24fa717a2ebba39cf3f7314 /lib/logger.rb
parent1469fdd06c6a88dbc59aead0ebd9ef5129574842 (diff)
* lib/logger.rb: typo fixed.
* test/logger/test_logger.rb: new file. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4580 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/logger.rb')
-rw-r--r--lib/logger.rb13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/logger.rb b/lib/logger.rb
index 848e6b3..7e8134e 100644
--- a/lib/logger.rb
+++ b/lib/logger.rb
@@ -104,7 +104,7 @@ class Logger
def info?; @level <= INFO; end
def warn?; @level <= WARN; end
def error?; @level <= ERROR; end
- def fatail?; @level <= FATAL; end
+ def fatal?; @level <= FATAL; end
# SYNOPSIS
# Logger.new(name, shift_age = 7, shift_size = 1048576)
@@ -128,7 +128,10 @@ class Logger
@progname = nil
@level = DEBUG
@datetime_format = nil
- @logdev = LogDevice.new(logdev, :shift_age => shift_age, :shift_size => shift_size) if logdev
+ @logdev = nil
+ if logdev
+ @logdev = LogDevice.new(logdev, :shift_age => shift_age, :shift_size => shift_size)
+ end
end
# SYNOPSIS
@@ -242,7 +245,7 @@ private
SEV_LABEL = %w(DEBUG INFO WARN ERROR FATAL ANY);
def format_severity(severity)
- SEV_LABEL[severity] || 'UNKNOWN'
+ SEV_LABEL[severity] || 'ANY'
end
def format_datetime(datetime)
@@ -253,9 +256,9 @@ private
end
end
+ Format = "%s, [%s#%d] %5s -- %s: %s\n"
def format_message(severity, timestamp, msg, progname)
- line = '%s, [%s#%d] %5s -- %s: %s' << "\n"
- line % [severity[0..0], timestamp, $$, severity, progname, msg]
+ Format % [severity[0..0], timestamp, $$, severity, progname, msg]
end
def msg2str(msg)