Log API

The LOG API allows you to efficiently format, write, and store log message to a device storage. It also helps you to manage the behavior of the application and the identification of errors and warnings.

You can use tags with the log methods to identify the source of the log messages and log calls. The Log API is supported on Android, iOS, and Web Application platforms.

For example, the logging system allows you to report and persist error, warning, and info messages so that you can later retrieve the message and analyze them to improve your app and the process steps.

The following are some of the main functions of Log API:

  • Monitor the app activity.
  • Create a unified logging system for capturing messages across the app or system.
  • Identify the source of log messages and log calls.
  • Govern the logging behavior and persisting it.
  • Allow you to configure which log message types are written.

Methods


logDebug

Use this method to formats and writes a debug-level message. These messages are used to collect information about activities or things that can be used during development phase.

Syntax

$m.logDebug(tag, message);

Parameters

tag: (String). Used to identify the source of the log message. The default value is the name of the current page.

message: (String). The format string containing the log message in the message template format.

Example

$m.logDebug("APP_TAG_DEBUG", "the log tag value can be anything")


logInfo

Use this method to formats and writes the info-level message. These messages are used to collect information that may be helpful and for troubleshooting errors.

Syntax

$m.logInfo(tag, message);

Parameters

tag: (String). Used to identify the source of the log message. The default value is the name of the current page.

message: (String). The format string containing the log message in the message template format.

Example

$m.logInfo("APP_TAG_INFO", "both values of the param can be any string")


logError

Use this method to formats and writes an error-level message. These messages are used for reporting process-level or compile time errors.

Syntax

$m.logError(tag, message);

Parameters

tag: (String). Used to identify the source of the log message. The default value is the name of the current page.

message: (String). The format string containing the log message in the message template format.

Example

$m.logError("APP_TAG_ERROR","Log message will come here");


logWarn

Use this method to formats and writes a warn-level massage. These messages are used to collect information that are warnings or more serious messages.

Syntax

$m.logWarn(tag, message);

Parameters

tag: (String). Used to identify the source of the log message. The default value is the name of the current page.

message: (String). The format string containing the log message in the message template format.

Example

$m.logWarn("APP_TAG_WARN","Log message will come here");


logFatal

Use this method to format and write fatal-level massage. These messages are used to collect information when the app doesn’t have necessary resources to operate optimally. Fatal is for severe error events that will lead to the application exit. Example scenarios are running out of disk space, loss of network connectivity, and missing any default configuration.

Syntax

$m.logFatal(tag, message);

Parameters

tag: (String). Used to identify the source of the log message. The default value is the name of the current page.

message: (String). The format string containing the log message in the message template format.

Example

$m.logFatal("APP_TAG_FATAL", "Log message will come here");