Interface InfiniteLogger

The InfiniteLogger interface is used to customize the way logging is handled.

This interface is used with setLogLevelBehavior. You may create your own class that implements the InfiniteLogger in order to customize the behavior of the logging.

/** 
* Sample to illustrate the use of the logging system.
*/
import { InfiniteApiControllerInterface, InfiniteFactory, InfiniteLogger, LogLevel, LogBehavior } from 'generated/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);

Please refer to the [InfiniteApiControllerInterface](InfiniteApiControllerInterface.html) for more information.
Main

See

setLogLevelBehavior

Hierarchy

  • InfiniteLogger

Methods

Methods

  • Adds a log item.

    Parameters

    • pContent: string
      in
      The content of the log.
    • pDate: Date
      in
      The date of the log.
    • pLevel: LogLevel
      in
      The level of the log.

    Returns void