sys.logs
This package contains methods to log events of the application. These logs can be seen in the app monitor so they are a great tool to know what your app is doing.
You can configure your app to trigger alerts when error or warning messages are logged to proactively monitor your app.
info(message, exception)
Logs a message with the INFO
level.
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
message |
|
yes |
The message to log. |
|
exception |
|
no |
An optional exception, which is useful to log the stack trace and information about the exception. |
Samples
// logs something in the app
sys.logs.info('this is a test info log');
warn(message, exception)
Logs a message with the WARN
level.
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
message |
|
yes |
The message to log. |
|
exception |
|
no |
An optional exception, which is useful to log the stack trace and information about the exception. |
Samples
// logs something in the app
sys.logs.warn('this is a test warn log');
error(message, exception)
Logs a message with the ERROR
level.
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
message |
|
yes |
The message to log. |
|
exception |
|
no |
An optional exception, which is useful to log the stack trace and information about the exception. |
Samples
// logs something in the app
sys.logs.error('this is a test error log');
// catches an exception and logs a message with the exception
try {
sys.data.find('entityThatDoesNotExist', {});
} catch (e) {
sys.logs.error('there was an error when doing query', e);
}
debug(message, exception)
Logs a message with the INFO
level for development purposes. This service only works on Development environment.
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
message |
|
yes |
The message to log. |
|
exception |
|
no |
An optional exception, which is useful to log the stack trace and information about the exception. |
Samples
// logs something in the app
sys.logs.debug('this is a test debug log');