Enumeration
enum LogLevel
public enum LogLevel <: ToString {
| OFF
| ERROR
| WARN
| INFO
| DEBUG
| TRACE
| ALL
}
Description: Indicates the print level.
Seven logging levels are defined, which are OFF
, ERROR
, WARN
, INFO
, DEBUG
, TRACE
, and ALL
in ascending order.
In the implementation of the SimpleLogger class, the logging level and the level of each log are specified. Only the logs whose levels are lower than or equal to the specified print level are printed to the output stream.
Parent Type:
ALL
ALL
Description: Constructs an enumeration instance of the logging level of ALL
.
DEBUG
DEBUG
Description: Constructs an enumeration instance of the logging level of DEBUG
.
ERROR
ERROR
Description: Constructs an enumeration instance of the logging level of ERROR
.
INFO
INFO
Description: Constructs an enumeration instance of the logging level of INFO
.
OFF
OFF
Description: Constructs an enumeration instance of the logging level of OFF
.
TRACE
TRACE
Description: Constructs an enumeration instance of the logging level of TRACE
.
WARN
WARN
Description: Constructs an enumeration instance of the logging level of WARN
.
func level()
public func level(): Int64
Description: Obtains the number corresponding to a log level, such as 1 for OFF
and 2 for ERROR
. The number increases by 1 in sequence.
Returns:
- Int64: number corresponding to the current log level
func toString()
public func toString(): String
Description: Obtains the name of a log level.
Returns:
- String: name of the current log level
operator func >=(LogLevel)
public operator func >=(target: LogLevel): Bool
Description: Compares two log levels.
Parameters:
- target: LogLevel:
target
to be compared with the current log level
Returns:
- Bool: If the current log level is higher than or equal to
target
,true
is returned. Otherwise,false
is returned.