Functions - log

printDebug

Logs the specified value at DEBUG level.

printError

Logs the specified message at ERROR level.

printInfo

Logs the specified message at INFO level.

printTrace

Logs the specified message at TRACE level.

printWarn

Logs the specified message at WARN level.

setModuleLogLevel

Sets the module log level.

printDebug

(anydata | function() returns (anydata) msg)

Logs the specified value at DEBUG level.

 log:printDebug("debug log");

Parameters

  • msg anydata | function() returns (anydata)
  • The message to be logged

printError

(anydata | function() returns (anydata) msg, error? err)

Logs the specified message at ERROR level.

 error e = error("error occurred");
 log:printError("error log with cause", err = e);

Parameters

  • msg anydata | function() returns (anydata)
  • The message to be logged

  • err error? (default <error?> ())
  • The error struct to be logged

printInfo

(anydata | function() returns (anydata) msg)

Logs the specified message at INFO level.

 log:printInfo("info log");

Parameters

  • msg anydata | function() returns (anydata)
  • The message to be logged

printTrace

(anydata | function() returns (anydata) msg)

Logs the specified message at TRACE level.

 log:printTrace("trace log");

Parameters

  • msg anydata | function() returns (anydata)
  • The message to be logged

printWarn

(anydata | function() returns (anydata) msg)

Logs the specified message at WARN level.

 log:printWarn("warn log");

Parameters

  • msg anydata | function() returns (anydata)
  • The message to be logged

setModuleLogLevel

(LogLevel logLevel, string? moduleName)

Sets the module log level. If a module name is not specified, the log level will be set to the current module. Following log levels are allowed.

ERROR - error log level

WARN - warn log level

INFO - info log level

DEBUG - debug log level

TRACE - trace log level

OFF - turns off logging

ALL - enables all the log levels

 log:setModuleLevelLog(log:DEBUG, moduleName=“alpha”);
 log:setModuleLevelLog(log:WARN);

Parameters

  • moduleName string? (default <string?> ())
  • Name of the module