Functions
printDebug | I Prints debug logs. |
printError | I Prints error logs. |
printInfo | I Prints info logs. |
printWarn | I Prints warn logs. |
setOutputFile | I Set the log output to a file. |
printDebug
function printDebug(string msg, error? 'error, StackFrame[ ]? stackTrace, *KeyValues keyValues)
Prints debug logs.
1log:printDebug("debug message", id = 845315)
Parameters
- msg string
The message to be logged
- 'error error? (default ())
The error struct to be logged
- stackTrace StackFrame[ ]? (default ())
The error stack trace to be logged
- keyValues *KeyValues
The key-value pairs to be logged
printError
function printError(string msg, error? 'error, StackFrame[ ]? stackTrace, *KeyValues keyValues)
Prints error logs.
1error e = error("error occurred");2log:printError("error log with cause", 'error = e, id = 845315);
Parameters
- msg string
The message to be logged
- 'error error? (default ())
The error struct to be logged
- stackTrace StackFrame[ ]? (default ())
The error stack trace to be logged
- keyValues *KeyValues
The key-value pairs to be logged
printInfo
function printInfo(string msg, error? 'error, StackFrame[ ]? stackTrace, *KeyValues keyValues)
Prints info logs.
1log:printInfo("info message", id = 845315)
Parameters
- msg string
The message to be logged
- 'error error? (default ())
The error struct to be logged
- stackTrace StackFrame[ ]? (default ())
The error stack trace to be logged
- keyValues *KeyValues
The key-value pairs to be logged
printWarn
function printWarn(string msg, error? 'error, StackFrame[ ]? stackTrace, *KeyValues keyValues)
Prints warn logs.
1log:printWarn("warn message", id = 845315)
Parameters
- msg string
The message to be logged
- 'error error? (default ())
The error struct to be logged
- stackTrace StackFrame[ ]? (default ())
The error stack trace to be logged
- keyValues *KeyValues
The key-value pairs to be logged
setOutputFile
function setOutputFile(string path, FileWriteOption option) returns Error?
Set the log output to a file. Note that all the subsequent logs of the entire application will be written to this file.
1var result = log:setOutputFile("./resources/myfile.log");2var result = log:setOutputFile("./resources/myfile.log", log:OVERWRITE);
Parameters
- path string
The path of the file
- option FileWriteOption (default APPEND)
To indicate whether to overwrite or append the log output