Console appender
Console is the simplest appender. It just writes the log messages
to io.stdout or io.stderr.
function logging.console {
[destination = "stdout"|"stderr",]
[logPattern = string,]
[logPatterns = {
[logging.DEBUG = string,]
[logging.INFO = string,]
[logging.WARN = string,]
[logging.ERROR = string,]
[logging.FATAL = string,]
},]
[timestampPattern = string,]
[logLevel = log-level-constant,]
}
logPatterns:
A table with logPattern strings indexed by the log-levels. A logPattern specifies how the message is written.
If this parameter is omitted, a patterns table will be created with the parameterlogPatternas the default value for each log-level. IflogPatternalso is omitted then each level will fall back to the current default setting, seelogging.defaultLogPatterns.logPattern:
This value will be used as the default value for each log-level that was omitted inlogPatterns.timestampPattern:
This is an optional parameter that can be used to specify a date/time formatting in the log message. The default is taken fromlogging.defaultTimestampPattern().destination:
The destination stream, optional. The value can be either"stdout", or"stderr". The default isstdout.logLevel:
The initial log-level to set for the created logger.
Examples
require"logging.console"
local logger = logging.console()
logger:info("logging.console test")
logger:debug("debugging...")
logger:error("error!")