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, *KeyValues keyValues)
Isolated Function

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

  • keyValues *KeyValues
  • The key-value pairs to be logged

printError

function printError(string msg, error? 'error, *KeyValues keyValues)
Isolated Function

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

  • keyValues *KeyValues
  • The key-value pairs to be logged

printInfo

function printInfo(string msg, error? 'error, *KeyValues keyValues)
Isolated Function

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

  • keyValues *KeyValues
  • The key-value pairs to be logged

printWarn

function printWarn(string msg, error? 'error, *KeyValues keyValues)
Isolated Function

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

  • keyValues *KeyValues
  • The key-value pairs to be logged

setOutputFile

function setOutputFile(string path, FileWriteOption option) returns Error?
Isolated Function

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

Return Type

(Error?)

A log:Error if an invalid file path was provided