Enumeration LogLevel

The LogLevel enumeration lists the available log levels to be use with the InfiniteApiControllerInterface.

Adding a log item is done with a criticality, and if the current log level (as set by InfiniteApiControllerInterface.setLogLevel) is strictly superior to the criticality of the log item, the log item is discarded.

You may also install a custom log behavior on a specific criticality with InfiniteApiControllerInterface.setLogLevelBehavior.

/** 
* Sample to illustrate the use of the logging system.
*/
import { InfiniteApiControllerInterface, InfiniteFactory, InfiniteLogger, LogLevel, LogBehavior } from 'generated_files/documentation/appinfiniteapi';

// a custom logger
class MyLogger implements InfiniteLogger
{
// just output a fancy message, but you may use your own GUI
addLog(pContent : string, pDate : Date, pLevel : LogLevel) : void
{
console.log('got log ' + pContent + ' at time ' + pDate + ' at level ' + pLevel);
}
}

// the api controller interface (no need to create it, it is available !)
const lControllerInterface : InfiniteApiControllerInterface = InfiniteFactory.GetInfiniteApiController();
// create our custom logger
const lLogger : MyLogger = new MyLogger();
// no message less than information
lControllerInterface.setLogLevel(LogLevel.LL_Information);
// and we use our custom logger for the Information level
lControllerInterface.setLogLevelBehavior(LogLevel.LL_Information, LogBehavior.LB_LogToObject, lLogger);

// add some logs
lControllerInterface.addLog('this log should be discarded', LogLevel.LL_Debug);

lControllerInterface.addLog('this log should be displayed with my fancy logger', LogLevel.LL_Information);

The default log level is LL_UsingDisposedObject.
Main

Enumeration Members

LL_Critical: 4

Critical log level.

Default behavior is a console.warn.

LL_Debug: 0

Debug Log level.

Default behavior is a console.log.

LL_Information: 2

Information log level.

Default behavior is a console.log.

LL_Required: 5

Required log level.

Log items on this type cannot be overridden, nor discarded.

Behavior is a console.log.

LL_UsingDisposedObject: 1

A message is outputted when a disposed object is used.

Default behavior is a console.log.

LL_Warning: 3

Warning log level.

Default behavior is a console.warn.