Class: Logger

system.logging. Logger


new Logger(channel)

A Logger object is used to log messages for a specific system or application components.

A Logger object is used to log messages for a specific system or application components. Loggers are normally named, using a hierarchical dot-separated namespace. Logger names can be arbitrary strings, but they should normally be based on the package name or class name of the logged component, such as com.mydomain or myapp.version.

Logger objects may be obtained by calls on one of the Log.getLogger factory methods. These will either create a new Logger singleton or return a suitable existing Logger.

Parameters:
Name Type Description
channel string

The channel of the logger.

Example
var Log = system.logging.Log ;
var LoggerLevel = system.logging.LoggerLevel ;
var ConsoleTarget = system.logging.targets.ConsoleTarget ;

var logger = Log.getLogger('channel') ;

var target = new ConsoleTarget
({
    includeChannel      : true  ,
    includeDate         : false ,
    includeLevel        : true  ,
    includeLines        : true  ,
    includeMilliseconds : true  ,
    includeTime         : true
}) ;

target.filters = ['*'] ;
target.level   = LoggerLevel.ALL ;

logger.debug( 'hello {0}, love it.' , 'VEGAS' ) ;
logger.critical( 'hello {0}, it\'s critical.' , 'VEGAS' ) ;
logger.info( 'hello, my name is {0}' , 'VEGAS' ) ;
logger.error( 'hello {0}, an error is invoked.' , 'VEGAS' ) ;
logger.warning( 'hello {0}, don\'t forget me.' , 'VEGAS' ) ;
logger.wtf( 'hello {0} ! WHAT ??' , 'VEGAS' ) ;

Members


<readonly> channel :string

Indicates the channel value for the logger.

Type:
  • string

Methods


critical(context, options)

Logs the specified data using the LoggerLevel.CRITICAL level.

Parameters:
Name Type Argument Description
context *

The message or information to log. If the passedin value is a string, you can contain special marker characters of the form {x}, where x is a zero based index that will be replaced with the additional parameters found at that index if specified.

options Object <repeatable>

Additional parameters that can be subsituted in the str parameter at each "{x}" location, where x is an integer (zero based) index value into the Array of values specified.


debug(context, options)

Logs the specified data using the LoggerLevel.DEBUG level.

Parameters:
Name Type Argument Description
context *

The message or information to log. If the passedin value is a string, you can contain special marker characters of the form {x}, where x is a zero based index that will be replaced with the additional parameters found at that index if specified.

options Object <repeatable>

Additional parameters that can be subsituted in the str parameter at each "{x}" location, where x is an integer (zero based) index value into the Array of values specified.


error(context, options)

Logs the specified data using the LoggerLevel.ERROR level.

Parameters:
Name Type Argument Description
context *

The message or information to log. If the passedin value is a string, you can contain special marker characters of the form {x}, where x is a zero based index that will be replaced with the additional parameters found at that index if specified.

options Object <repeatable>

Additional parameters that can be subsituted in the str parameter at each "{x}" location, where x is an integer (zero based) index value into the Array of values specified.


info(context, options)

Logs the specified data using the LoggerLevel.INFO level.

Parameters:
Name Type Argument Description
context *

The message or information to log. If the passedin value is a string, you can contain special marker characters of the form {x}, where x is a zero based index that will be replaced with the additional parameters found at that index if specified.

options Object <repeatable>

Additional parameters that can be subsituted in the str parameter at each "{x}" location, where x is an integer (zero based) index value into the Array of values specified.


log(context, options)

Logs the specified data using the LoggerLevel.ALL level.

Parameters:
Name Type Argument Description
context *

The message or information to log. If the passedin value is a string, you can contain special marker characters of the form {x}, where x is a zero based index that will be replaced with the additional parameters found at that index if specified.

options Object <repeatable>

Additional parameters that can be subsituted in the str parameter at each "{x}" location, where x is an integer (zero based) index value into the Array of values specified.

See:
  • core.strings.fastformat

toString()

Returns the String representation of the object.

Returns:

the String representation of the object.


warning(context, options)

Logs the specified data using the LoggerLevel.WARNING level.

Parameters:
Name Type Argument Description
context *

The message or information to log. If the passedin value is a string, you can contain special marker characters of the form {x}, where x is a zero based index that will be replaced with the additional parameters found at that index if specified.

options Object <repeatable>

Additional parameters that can be subsituted in the str parameter at each "{x}" location, where x is an integer (zero based) index value into the Array of values specified.


wtf(context, options)

What a Terrible Failure: Report an exception that should never happen.

Parameters:
Name Type Argument Description
context *

The message or information to log. If the passedin value is a string, you can contain special marker characters of the form {x}, where x is a zero based index that will be replaced with the additional parameters found at that index if specified.

options Object <repeatable>

Additional parameters that can be subsituted in the str parameter at each "{x}" location, where x is an integer (zero based) index value into the Array of values specified.