Extended maintenance of Ruby versions 1.8.7 and 1.9.2 ended on July 31, 2014. Read more
# File webrick/log.rb, line 18 def initialize(log_file=nil, level=nil) @level = level || INFO case log_file when String @log = open(log_file, "a+") @log.sync = true @opened = true when NilClass @log = $stderr else @log = log_file # requires "<<". (see BasicLog#log) end end
# File webrick/log.rb, line 32 def close @log.close if @opened @log = nil end
# File webrick/log.rb, line 52 def debug(msg) log(DEBUG, "DEBUG " << format(msg)); end
# File webrick/log.rb, line 49 def error(msg) log(ERROR, "ERROR " << format(msg)); end
# File webrick/log.rb, line 48 def fatal(msg) log(FATAL, "FATAL " << format(msg)); end
# File webrick/log.rb, line 51 def info(msg) log(INFO, "INFO " << format(msg)); end
# File webrick/log.rb, line 37 def log(level, data) if @log && level <= @level data += "\n" if /\n\Z/ !~ data @log << data end end