enum
Logit::LogLevel
Overview
Log severity levels, ordered from least to most severe.
Events are only logged if their level is greater than or equal to the
backend's configured minimum level. For example, if a backend is set
to Info, only Info, Warn, Error, and Fatal events are logged.
Level Descriptions
Trace- Very detailed debugging information, typically only useful when diagnosing specific issuesDebug- Detailed information useful during developmentInfo- General operational information (default level)Warn- Warning conditions that don't prevent operation but may indicate problemsError- Error conditions that prevented an operation from completingFatal- Severe errors that may cause the application to terminate
Comparison
Log levels can be compared using standard comparison operators:
Logit::LogLevel::Info > Logit::LogLevel::Debug # => true
Logit::LogLevel::Warn >= Logit::LogLevel::Info # => true
Parsing
Log levels can be parsed from strings (case-insensitive):
level = Logit::LogLevel.parse("debug") # => LogLevel::Debug
level = Logit::LogLevel.parse("INFO") # => LogLevel::Info
Defined in:
logit/log_level.crEnum Members
-
Trace =
0 -
Very detailed debugging information.
-
Debug =
1 -
Detailed information useful during development.
-
Info =
2 -
General operational information (default level).
-
Warn =
3 -
Warning conditions that may indicate problems.
-
Error =
4 -
Error conditions that prevented an operation.
-
Fatal =
5 -
Severe errors that may terminate the application.
Constructors
-
.parse(str : String) : LogLevel
Parses a log level from a string (case-insensitive).
Instance Method Summary
-
#<(other : LogLevel) : Bool
Compares this object to other based on the receiver’s
<=>method, returningtrueif it returns a negative number. -
#<=(other : LogLevel) : Bool
Compares this object to other based on the receiver’s
<=>method, returningtrueif it returns a value equal or less then0. -
#>(other : LogLevel) : Bool
Compares this object to other based on the receiver’s
<=>method, returningtrueif it returns a value greater then0. -
#>=(other : LogLevel) : Bool
Compares this object to other based on the receiver’s
<=>method, returningtrueif it returns a value equal or greater than0. -
#debug?
Returns
trueif this enum value equalsDebug -
#error?
Returns
trueif this enum value equalsError -
#fatal?
Returns
trueif this enum value equalsFatal -
#info?
Returns
trueif this enum value equalsInfo -
#to_s(io : IO) : Nil
Appends a
Stringrepresentation of this enum member to the given io. -
#to_s : String
Returns a
Stringrepresentation of this enum member. -
#trace?
Returns
trueif this enum value equalsTrace -
#warn?
Returns
trueif this enum value equalsWarn
Constructor Detail
Parses a log level from a string (case-insensitive).
Raises ArgumentError if the string is not a valid level name.
Instance Method Detail
Compares this object to other based on the receiver’s <=> method,
returning true if it returns a negative number.
Compares this object to other based on the receiver’s <=> method,
returning true if it returns a value equal or less then 0.
Compares this object to other based on the receiver’s <=> method,
returning true if it returns a value greater then 0.
Compares this object to other based on the receiver’s <=> method,
returning true if it returns a value equal or greater than 0.
Appends a String representation of this enum member to the given io.
See also: #to_s.
Returns a String representation of this enum member.
In the case of regular enums, this is just the name of the member.
In the case of flag enums, it's the names joined by vertical bars, or "None",
if the value is zero.
If an enum's value doesn't match a member's value, the raw value is returned as a string.
Color::Red.to_s # => "Red"
IOMode::None.to_s # => "None"
(IOMode::Read | IOMode::Write).to_s # => "Read | Write"
Color.new(10).to_s # => "10"