summaryrefslogtreecommitdiff
path: root/lib/webrick/log.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/webrick/log.rb')
-rw-r--r--lib/webrick/log.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/webrick/log.rb b/lib/webrick/log.rb
index 765599a..fe253e5 100644
--- a/lib/webrick/log.rb
+++ b/lib/webrick/log.rb
@@ -9,12 +9,23 @@
# $IPR: log.rb,v 1.26 2002/10/06 17:06:10 gotoyuzo Exp $
module WEBrick
+
+ ##
+ # A generic logging class
+
class BasicLog
# log-level constant
FATAL, ERROR, WARN, INFO, DEBUG = 1, 2, 3, 4, 5
attr_accessor :level
+ ##
+ # Initializes a new logger for +log_file+ that outputs messages at +level+
+ # or higher. +log_file+ can be a filename, an IO-like object that
+ # responds to #<< or nil which outputs to $stderr.
+ #
+ # If no level is given INFO is chosen by default
+
def initialize(log_file=nil, level=nil)
@level = level || INFO
case log_file
@@ -71,6 +82,9 @@ module WEBrick
end
end
+ ##
+ # A logging class with timestamps
+
class Log < BasicLog
attr_accessor :time_format