Skip to main content

 

Reference

 

Applies only to Mobile Apps and Reactive Web Apps
OutSystems

Logger

Provides methods to log messages or errors. Used as "console.log" but also logs messages in Service Center.

This logger will work both as a console.log logger and as server logger, sending the log messages to Service Center. When offline, the log messages will be temporarily saved in local storage; when online, they will be sent to Service Center.

Summary

Functions
error Logs an error.
log Logs a message.

Functions

error

error(module: string, messageOrError: string | Error, [error: Error]): void

Logs an error.

If both messageOrError and error arguments are supplied, message information (and stack information, if messageOrError is an Error object) will be concatenated using \n as separator before being logged.

Example 1:

try {
  // do some synchronous operations
} catch(e) {
  $public.Logger.error("MainModule", e);
}

Example 2 (error logging in asynchronous code):

yourClientAsyncAction().then(function() {
  // do some operations that can throw an error
}).catch(function(err) {
  $public.Logger.error("MainModule", err);
});

Parameters:

  • module: string
    Name of a module to log.
  • messageOrError: string | Error
    Error or message to log.
  • (Optional) error: Error
    Error object.

Returns: void

log

log(module: string, message: string): void

Logs a message.

Parameters:

  • module: string
    Name of a module to log.
  • message: string
    Log message.

Returns: void

  • Was this article helpful?