1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
|
module WEBrick
class BasicLog
@log: IO?
@opened: TrueClass?
FATAL: 1
ERROR: 2
WARN: 3
INFO: 4
DEBUG: 5
# log-level, messages above this level will be logged
attr_accessor level: Integer
type log_file = (IO | String)?
def initialize: (?log_file log_file, ?Integer? level) -> void
#
# Closes the logger (also closes the log device associated to the logger)
def close: () -> void
def log: (Integer level, String data) -> IO?
#
# Synonym for log(INFO, obj.to_s)
def <<: (_ToS obj) -> IO?
type message = Exception | _ToStr | Object
# Shortcut for logging a FATAL message
def fatal: (message msg) -> IO?
# Shortcut for logging an ERROR message
def error: (message msg) -> IO?
# Shortcut for logging a WARN message
def warn: (message msg) -> IO?
# Shortcut for logging an INFO message
def info: (message msg) -> IO?
# Shortcut for logging a DEBUG message
def debug: (message msg) -> IO?
# Will the logger output FATAL messages?
def fatal?: () -> bool
# Will the logger output ERROR messages?
def error?: () -> bool
# Will the logger output WARN messages?
def warn?: () -> bool
# Will the logger output INFO messages?
def info?: () -> bool
# Will the logger output DEBUG messages?
def debug?: () -> bool
private
#
# Formats +arg+ for the logger
#
# * If +arg+ is an Exception, it will format the error message and
# the back trace.
# * If +arg+ responds to #to_str, it will return it.
# * Otherwise it will return +arg+.inspect.
def format: (message arg) -> String
end
class Log < BasicLog
# Format of the timestamp which is applied to each logged line. The
# default is <tt>"[%Y-%m-%d %H:%M:%S]"</tt>
attr_accessor time_format: String
#
# Same as BasicLog#initialize
#
# You can set the timestamp format through #time_format
def initialize: (?BasicLog::log_file log_file, ?Integer? level) -> void
#
# Same as BasicLog#log
def log: (Integer level, String data) -> IO?
end
end
|