Logger API
Logging Business API
Summary
The Logger functionality provides the ability to log application messages, the logger can be configured to log only messages if the desired logging level are set.
There are 5 levels of logging in Servicely.
- Error
- Warning
- Info
- Debug
- Trace
Logging level
The logging level can be set as part of the code where logging is been used.
Basic configuration:
let myLogger = Logger(“workflowLog”);By default these debug levels are set:
- Error (enabled)
- Warning (enabled)
- Info (enabled)
Advanced configuration:
let myLogger = Logger(“workflowLog”);The log level can be set inside the script (Java script code) with logLevel(“Warn”).
To have the ability to change log levels on demand or for a specific instance it can be configured in the Servicely backend by navigating to:
Administration => Logging & statistics => System log level
Field | Description | |
|---|---|---|
Source | Name of the Logger | |
Level | Debug level |
|
Constructor
Method | Description |
|---|---|
Logger(name: String) | Creates a logger with the specified name |
Methods
Method | Description |
|---|---|
logLevel(): String | Returns the current log level as a string |
logLevel(level: String): LoggerObjectWrapper | Sets the logging level of the logger |
isErrorEnabled(): Boolean | Used as a check to see if the error logging level has been enabled. |
isWarnEnabled(): Boolean | Used as a check to see if the warning logging level has been enabled. |
isInfoEnabled(): Boolean | Used as a check to see if the info logging level has been enabled. |
isDebugEnabled(): Boolean | Used as a check to see if the debug logging level has been enabled. |
isTraceEnabled(): Boolean | Used as a check to see if the trace logging level has been enabled. |
error(args: Array<*>) | Used to log an error. |
warn(args: Array<*>) | Used to log a warning. |
info(args: Array<*>) | Used to log an info message. |
debug(args: Array<*>) | Used to log a debug message. |
trace(args: Array<*>) | Used to log a trace message. |