Class

class SimpleLogger

public class SimpleLogger <: Logger {
    public init()
    public init(name: String, level: LogLevel, output: OutputStream)
}

Description: Implements the Logger interface and provides basic log printing and management functions.

This class supports customizing the log name, logging level, and output stream. By default, the log name is "Logger", the print level is INFO, and the output stream is stdOut.

Parent Type:

prop level

public mut prop level: LogLevel

Description: Obtains and modifies the logging level.

Type: LogLevel

init()

public init()

Description: Creates a default SimpleLogger instance.

init(String, LogLevel, OutputStream)

public init(name: String, level: LogLevel, output: OutputStream)

Description: Creates a SimpleLogger instance and specifies the log name, logging level, and output stream.

Parameters:

func debug(String)

public func debug(msg: String): Unit

Description: Prints DEBUG-level logs.

Parameters:

func error(String)

public func error(msg: String): Unit

Description: Prints ERROR-level logs.

Parameters:

func flush()

public func flush(): Unit

Description: Refreshes the output stream.

func info(String)

public func info(msg: String): Unit

Description: Prints INFO-level logs.

Parameters:

func log(LogLevel, String)

public func log(level: LogLevel, msg: String): Unit

Description: Prints logs. The log level must be specified.

Parameters:

func setOutput(OutputStream)

public func setOutput(output: OutputStream): Unit

Description: Sets the output stream to which log information is printed.

Parameters:

func trace(String)

public func trace(msg: String): Unit

Description: Prints TRACE-level logs.

Parameters:

func warn(String)

public func warn(msg: String): Unit

Description: Prints WARN-level logs.

Parameters: