class WEBrick::BasicLog

def <<(obj)

Synonym for log(INFO, obj.to_s)
#
def <<(obj)
  log(INFO, obj.to_s)
end

def close

Closes the logger (also closes the log device associated to the logger)
#
def close
  @log.close if @opened
  @log = nil
end

def debug(msg) log(DEBUG, "DEBUG " + format(msg)); end

Shortcut for logging a DEBUG message
def debug(msg) log(DEBUG, "DEBUG " + format(msg)); end

def debug?; @level >= DEBUG; end

Will the logger output DEBUG messages?
def debug?; @level >= DEBUG; end

def error(msg) log(ERROR, "ERROR " + format(msg)); end

Shortcut for logging an ERROR message
def error(msg) log(ERROR, "ERROR " + format(msg)); end

def error?; @level >= ERROR; end

Will the logger output ERROR messages?
def error?; @level >= ERROR; end

def fatal(msg) log(FATAL, "FATAL " + format(msg)); end

Shortcut for logging a FATAL message
def fatal(msg) log(FATAL, "FATAL " + format(msg)); end

def fatal?; @level >= FATAL; end

Will the logger output FATAL messages?
def fatal?; @level >= FATAL; end

def format(arg)

* Otherwise it will return +arg+.inspect.
* If +arg+ responds to #to_str, it will return it.
the back trace.
* If +arg+ is an Exception, it will format the error message and

Formats +arg+ for the logger
#
def format(arg)
  if arg.is_a?(Exception)
    +"#{arg.class}: #{AccessLog.escape(arg.message)}\n\t" <<
    arg.backtrace.join("\n\t") << "\n"
  elsif arg.respond_to?(:to_str)
    AccessLog.escape(arg.to_str)
  else
    arg.inspect
  end
end

def info(msg) log(INFO, "INFO " + format(msg)); end

Shortcut for logging an INFO message
def info(msg)  log(INFO,  "INFO  " + format(msg)); end

def info?; @level >= INFO; end

Will the logger output INFO messages?
def info?;  @level >= INFO; end

def initialize(log_file=nil, level=nil)

def initialize(log_file=nil, level=nil)
  @level = level || INFO
  case log_file
  when String
    @log = File.open(log_file, "a+")
    @log.sync = true
    @opened = true
  when NilClass
    @log = $stderr
  else
    @log = log_file  # requires "<<". (see BasicLog#log)
  end
end

def log(level, data)

def log(level, data)
  if @log && level <= @level
    data += "\n" if /\n\Z/ !~ data
    @log << data
  end
end

def warn(msg) log(WARN, "WARN " + format(msg)); end

Shortcut for logging a WARN message
def warn(msg)  log(WARN,  "WARN  " + format(msg)); end

def warn?; @level >= WARN; end

Will the logger output WARN messages?
def warn?;  @level >= WARN; end