class RemiLib::Logger
- RemiLib::Logger
- Reference
- Object
Overview
The base Logger class provides basic logging facilities.
The format of each message is:
[Header]: your message
Direct Known Subclasses
Defined in:
remilib/logging.crConstant Summary
-
ANSI_REGEX =
Regex.new("\e\\[[0-9;]*m")
Constructors
Instance Method Summary
-
#<<(text)
Prints a message to
#defaultStreamby callingblock, which must return a string. -
#debugColor : Symbol
The color of the debug log header
-
#debugColor=(debugColor : Symbol)
The color of the debug log header
-
#debugHeader : String
The header printed before each debug log message.
-
#debugHeader=(debugHeader : String)
The header printed before each debug log message.
-
#debugLevel : UInt8
The debugging level.
-
#debugLevel=(debugLevel : UInt8)
The debugging level.
-
#debugStream : IO
The stream that debug messages are printed to
-
#debugStream=(debugStream : IO)
The stream that debug messages are printed to
-
#defaultColor : Symbol
The color of the default log header
-
#defaultColor=(defaultColor : Symbol)
The color of the default log header
-
#defaultHeader : String
The default log header.
-
#defaultHeader=(defaultHeader : String)
The default log header.
- #defaultStream : IO
- #defaultStream=(defaultStream : IO)
-
#dlog(minLevel : UInt8, msg : String)
Prints a message to
#debugStreamif#debugLevelis greater than or equal tominLevel. -
#dlog(minLevel : UInt8, &block : Proc(String)) : Bool
Prints a message to
#debugStreamif#debugLevelis greater than or equal tominLevelby callingblock, which must return a string. -
#dlog(msg : String) : Bool
Prints a message to
#debugStreamif#debugLevelis greater than or equal to 1. -
#dlog(&block : Proc(String)) : Bool
Prints a message to
#debugStreamif#debugLevelis greater than or equal to 1 by callingblock, which must return a string. -
#dlog!(msg : String) : Bool
Prints a message to
#debugStreamregardless of#debugLevel. -
#dlog!(&block : Proc(String)) : Bool
Prints a message to
#debugStreamregardless of#debugLevel. -
#ensureNewline=(ensureNewline : Bool)
When
true, all logging calls will ensure that a newline is printed after their message is printed. -
#ensureNewline? : Bool
When
true, all logging calls will ensure that a newline is printed after their message is printed. -
#error(msg : String)
Prints a message to
#errorStream. -
#error(&block : Proc(String))
Prints a message to
#errorStreamby callingblock, which must return a string. -
#error(err : Exception)
Prints an exception and its backtrace to
#errorStream. -
#errorColor : Symbol
The color of the error log header
-
#errorColor=(errorColor : Symbol)
The color of the error log header
-
#errorHeader : String
The header printed before each error log message.
-
#errorHeader=(errorHeader : String)
The header printed before each error log message.
-
#errorStream : IO
The stream that error messages are printed to
-
#errorStream=(errorStream : IO)
The stream that error messages are printed to
-
#fatal(msg : String, exitCode = 1) : NoReturn
Prints an error message to
#errorStream, then callsexitwithexitCode. -
#fatal(&block : Proc(Tuple(String, Int32))) : NoReturn
Prints an error message to
#errorStreamby callingblock. -
#fatal(err : Exception, exitCode = 1) : NoReturn
Prints an exception and its backtrace to
#errorStream, then callsexitwithexitCode. -
#fatalHeader : String
The header printed before a fatal log message.
-
#fatalHeader=(fatalHeader : String)
The header printed before a fatal log message.
-
#forceFlush=(forceFlush : Bool)
When true,
IO#flushwill be called after every log message. -
#forceFlush? : Bool
When true,
IO#flushwill be called after every log message. -
#log(msg : String)
Prints a message to
#defaultStream. -
#log(&block : Proc(String))
Prints a message to
#defaultStreamby callingblock, which must return a string. -
#noColors=(noColors : Bool)
When true, color output is completely disabled.
-
#noColors? : Bool
When true, color output is completely disabled.
-
#otherStreams : Array(IO)
Additional streams to log messages to.
-
#otherStreams=(otherStreams : Array(IO))
Additional streams to log messages to.
-
#sanitizeOutput=(sanitizeOutput : Bool)
When
true, then all output will have meta characters (ESC,SUB,BEL, etc.) stripped from the output and replaced with textual representations. -
#sanitizeOutput? : Bool
When
true, then all output will have meta characters (ESC,SUB,BEL, etc.) stripped from the output and replaced with textual representations. -
#showHeaders=(showHeaders : Bool)
When
true, headers are shown for all of the logging messages. -
#showHeaders? : Bool
When
true, headers are shown for all of the logging messages. -
#timestamp : String
When not
String#empty?, use this as aTime::Formatstring to append a timestamp to each header. -
#timestamp=(timestamp : String)
When not
String#empty?, use this as aTime::Formatstring to append a timestamp to each header. -
#trace(msg : String) : Bool
Prints a message to
#debugStreamonly if#debugLevelis equal to 255. -
#trace(&block : Proc(String)) : Bool
Prints a message to
#debugStreamby callingblock(which must return a string), but only if#debugLevelis equal to 255. -
#verboseColor : Symbol
The color of the verbose log header
-
#verboseColor=(verboseColor : Symbol)
The color of the verbose log header
-
#verboseHeader : String
The verbose log header.
-
#verboseHeader=(verboseHeader : String)
The verbose log header.
-
#verbosityLevel : UInt8
The verbosity level.
-
#verbosityLevel=(verbosityLevel : UInt8)
The verbosity level.
-
#vlog(minLevel : UInt8, msg : String) : Bool
Prints a message to
#defaultStreamif#verbosityLevelis greater than or equal tominLevel. -
#vlog(minLevel : UInt8, &block : Proc(String)) : Bool
Prints a message to
#defaultStreamif#verbosityLevelis greater than or equal tominLevelby callingblock, which must return a string. -
#vlog(msg : String) : Bool
Convenience function that just calls
#vlogwith a minimum level of 1. -
#vlog(&block : Proc(String)) : Bool
Convenience function that just calls
#vlogwith a minimum level of 1. -
#warn(msg : String)
Prints a message to
#warnStream. -
#warn(&block : Proc(String))
Prints a message to
#warnStreamby callingblock, which must return a string. -
#warn(err : Exception)
Prints an exception and its backtrace to
#warnStream. -
#warnColor : Symbol
The color of the warning log header
-
#warnColor=(warnColor : Symbol)
The color of the warning log header
-
#warnHeader : String
The header printed before each warrning log message.
-
#warnHeader=(warnHeader : String)
The header printed before each warrning log message.
-
#warnStream : IO
The stream that warning messages are printed to
-
#warnStream=(warnStream : IO)
The stream that warning messages are printed to
Constructor Detail
Instance Method Detail
Prints a message to #defaultStream by calling block, which must return
a string. If #defaultHeader is not an empty string, then this will
first print that header using #defaultColor.
Prints a message to #debugStream if #debugLevel is greater than or
equal to minLevel. This always prints a header using #debugHeader and
#debugColor.
If #debugLevel is less than minLevel, this does nothing.
Returns true if a message was printed, or false otherwise.
Prints a message to #debugStream if #debugLevel is greater than or
equal to minLevel by calling block, which must return a string. This
always prints a header using #debugHeader and #debugColor.
If #debugLevel is less than minLevel, this does nothing.
Returns true if a message was printed, or false otherwise.
Prints a message to #debugStream if #debugLevel is greater than or
equal to 1. This always prints a header using #debugHeader and
#debugColor.
Returns true if a message was printed, or false otherwise.
Prints a message to #debugStream if #debugLevel is greater than or
equal to 1 by calling block, which must return a string. This always
prints a header using #debugHeader and #debugColor.
Returns true if a message was printed, or false otherwise.
Prints a message to #debugStream regardless of #debugLevel. This
always prints a header using #debugHeader and #debugColor.
Prints a message to #debugStream regardless of #debugLevel. This
always prints a header using #debugHeader and #debugColor.
When true, all logging calls will ensure that a newline is
printed after their message is printed.
When true, all logging calls will ensure that a newline is
printed after their message is printed.
Prints a message to #errorStream. This always prints a header using
#errorHeader and #errorColor.
Prints a message to #errorStream by calling block, which must return a
string. This always prints a header using #errorHeader and
#errorColor.
Prints an exception and its backtrace to #errorStream. This always
prints a header using #errorHeader and #errorColor.
Prints an error message to #errorStream, then calls exit with
exitCode. This always uses the header "FATAL".
Prints an error message to #errorStream by calling block. The block
must return a tuple consisting of a string (the error message) and an
Int32 (the exit code). This then calls exit with the exit code
returned by `block. This always uses the header "FATAL".
Prints an exception and its backtrace to #errorStream, then calls exit
with exitCode. This always uses the header "FATAL".
When true, IO#flush will be called after every log message. This
applies to all streams associated with the instance.
When true, IO#flush will be called after every log message. This
applies to all streams associated with the instance.
Prints a message to #defaultStream. If #defaultHeader is not an empty
string, then this will first print that header using #defaultColor.
Prints a message to #defaultStream by calling block, which must return
a string. If #defaultHeader is not an empty string, then this will
first print that header using #defaultColor.
When true, then all output will have meta characters (ESC, SUB,
BEL, etc.) stripped from the output and replaced with textual
representations.
See ::RemiLib.sanitize for more info.
When true, then all output will have meta characters (ESC, SUB,
BEL, etc.) stripped from the output and replaced with textual
representations.
See ::RemiLib.sanitize for more info.
When true, headers are shown for all of the logging messages. However,
note that #log/#<< have additional constraints. See them for more
details.
When true, headers are shown for all of the logging messages. However,
note that #log/#<< have additional constraints. See them for more
details.
When not String#empty?, use this as a Time::Format string to
append a timestamp to each header. If this is empty, no
timestamp is shown.
Note that if the header is also an empty string, no timestamp will be shown for that message.
When not String#empty?, use this as a Time::Format string to
append a timestamp to each header. If this is empty, no
timestamp is shown.
Note that if the header is also an empty string, no timestamp will be shown for that message.
Prints a message to #debugStream only if #debugLevel is equal to 255.
This always prints a header using #debugHeader and #debugColor.
Prints a message to #debugStream by calling block (which must return a
string), but only if #debugLevel is equal to 255. This always prints a
header using #debugHeader and #debugColor.
Prints a message to #defaultStream if #verbosityLevel is greater than
or equal to minLevel. If #verboseHeader is not an empty string, then
this will first print that header using #defaultColor.
If #verbosityLevel is less than minLevel, this does nothing.
Returns true if it printed something, or false otherwise.
Prints a message to #defaultStream if #verbosityLevel is greater than
or equal to minLevel by calling block, which must return a string. If
#verboseHeader is not an empty string, then this will first print that
header using #defaultColor.
If #verbosityLevel is less than minLevel, this does nothing.
Returns true if it printed something, or false otherwise.
Convenience function that just calls #vlog with a minimum level of 1.
Convenience function that just calls #vlog with a minimum level of 1.
Prints a message to #warnStream. This always prints a header using
#warnHeader and #warnColor.
Prints a message to #warnStream by calling block, which must return a
string. This always prints a header using #warnHeader and #warnColor.
Prints an exception and its backtrace to #warnStream. This always
prints a header using #warnHeader and #warnColor.