ibmmfpfanalytics.logger
The IBM® MobileFirst® logger API facilitates logging to the IBM MobileFirst server at all levels. Additionally it receives logging configuration from the server.
Note: The data collected via the logger
API can be sent to the IBM MobileFirst server and become available in the MobileFirst
Analytics Console (Apps -> Client Log Search).
Method Attributes | Method Name and Description |
---|---|
capture(flag)
Enable or disable the capture of the log messages. |
|
debug(message)
Logs a message with additional contextual information at the debug level. |
|
enable(flag)
Enable or disable the logger. |
|
error(message)
Logs a message with additional contextual information at the error level. |
|
fatal(message)
Logs a message with additional contextual information at the fatal level. |
|
info(message)
Logs a message with additional contextual information at the info level. |
|
log(message)
Logs a message with additional contextual information at the log level. |
|
pkg(packageName)
Adds optional package for the logger. |
|
state()
Returns the current state of logger.
|
|
trace(message)
Logs a message with additional contextual information at the trace level. |
|
Takes or updates the logger configuration definitions made on the MobileFirst server. |
|
warn(message)
Logs a message with additional contextual information at the warn level. |
Enable or disable the capture of the log messages.
By disabling the capture the messages will not be stored in the browser localStorage
and later delivered to the back-end.
logger.capture(false);
Logs a message with additional contextual information at the debug level.
Log messages are automatically added to a persistent queue. The accumulated data is automatically sent
to IBM® MobileFirst® server with the next explicit logger.send
function call.
logger.debug('my record');
// or
logger.debug({data: [1,2,3]});
//or
logger.debug('my record', 'another message');
Enable or disable the logger.
logger.enable(true);
Logs a message with additional contextual information at the error level.
Log messages are automatically added to a persistent queue. The accumulated data is automatically sent
to IBM® MobileFirst® server with the next explicit logger.send
function call.
logger.error('my record');
// or
logger.error({data: [1,2,3]});
//or
logger.error('my record', 'another message');
Logs a message with additional contextual information at the fatal level.
Log messages are automatically added to a persistent queue. The accumulated data is automatically sent
to IBM® MobileFirst® server with the next explicit logger.send
function call.
logger.fatal('my record');
// or
logger.fatal({data: [1,2,3]});
//or
logger.fatal('my record', 'another message');
Logs a message with additional contextual information at the info level.
Log messages are automatically added to a persistent queue. The accumulated data is automatically sent
to IBM® MobileFirst® server with the next explicit logger.send
function call.
logger.info('my record');
// or
logger.info({data: [1,2,3]});
//or
logger.info('my record', 'another message');
Logs a message with additional contextual information at the log level.
Log messages are automatically added to a persistent queue. The accumulated data is automatically sent
to IBM® MobileFirst® server with the next explicit logger.send
function call.
logger.log('my record');
// or
logger.log({data: [1,2,3]});
//or
logger.log('my record', 'another message');
Adds optional package for the logger.
You can chainpkg()
to the log calls as shown in the example below.
logger.pkg('com.mycompany.mymodule').info('my message');
ibmmfpfanalytics.logger.state();
Logs a message with additional contextual information at the trace level.
Log messages are automatically added to a persistent queue. The accumulated data is automatically sent
to IBM® MobileFirst® server with the next explicit logger.send
function call.
logger.trace('my record');
// or
logger.trace({data: [1,2,3]});
//or
logger.trace('my record', 'another message');
Takes or updates the logger configuration definitions made on the MobileFirst server.
logger.updateConfigFromServer()
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
Logs a message with additional contextual information at the warn level.
Log messages are automatically added to a persistent queue. The accumulated data is automatically sent
to IBM® MobileFirst® server with the next explicit logger.send
function call.
logger.warn('my record');
// or
logger.warn({data: [1,2,3]});
//or
logger.warn('my record', 'another message');