Home Manual Reference Source Repository
public class | source

Logger

Logger.js -- Provides dispatch to logging plugins. Logging can be turned off via invoking "setLogLevel('off')". By default all logging is enabled and the context is set to default. Add one or more logger plugins by invoking the setLogger method. Change the logging context by invoking setContext.

The following log levels are available in order of precedence: off, fatal, error, warn, info, debug, trace, all.

Constructor Summary

Public Constructor
public

Create the Logger with default values and all logging enabled.

Method Summary

Public Methods
public

debug()

Dispatch to the logger->debug if it exists and the log level is enabled.

public

error()

Dispatch to the logger->error if it exists and the log level is enabled.

public

fatal()

Dispatch to the logger->fatal if it exists and the log level is enabled.

public

Get the current context.

public

Get the log level for the current context.

public

getLogger(context: *): *

Get the logger by the given context.

public

hasContext(context: *): *

Returns whether a logger is defined by the given context.

public

info()

Dispatch to the logger->info if it exists and the log level is enabled.

public

Returns whether the given log level is enabled.

public

post(level: string, params: *)

Posts a log message given a log level and parameters.

public

removeLogger(context: *)

Removes the logger by the given context.

public

Sets the current context

public

Sets the current log level.

public

setLogger(context: string, logger: *)

Sets the logger for the give context.

public

trace()

Dispatch to the logger->trace if it exists and the log level is enabled.

public

warn()

Dispatch to the logger->warn if it exists and the log level is enabled.

Public Constructors

public constructor source

Create the Logger with default values and all logging enabled.

Public Methods

public debug() source

Dispatch to the logger->debug if it exists and the log level is enabled.

public error() source

Dispatch to the logger->error if it exists and the log level is enabled.

public fatal() source

Dispatch to the logger->fatal if it exists and the log level is enabled.

public getContext(): string | * source

Get the current context.

Return:

string | *

public getLogLevel(): * source

Get the log level for the current context.

Return:

*

public getLogger(context: *): * source

Get the logger by the given context.

Params:

NameTypeAttributeDescription
context *

the context to use for logger retrieval.

Return:

*

public hasContext(context: *): * source

Returns whether a logger is defined by the given context.

Params:

NameTypeAttributeDescription
context *

the context to check.

Return:

*

public info() source

Dispatch to the logger->info if it exists and the log level is enabled.

public isLevelEnabled(level: string): boolean source

Returns whether the given log level is enabled.

Params:

NameTypeAttributeDescription
level string

log level

Return:

boolean

public post(level: string, params: *) source

Posts a log message given a log level and parameters.

Params:

NameTypeAttributeDescription
level string

log level

params *

log message parameters to forward onto dispatched method.

public removeLogger(context: *) source

Removes the logger by the given context.

Params:

NameTypeAttributeDescription
context *

The context to check.

public setContext(context: string): boolean source

Sets the current context

Params:

NameTypeAttributeDescription
context string

The context to set.

Return:

boolean

public setLogLevel(level: string): boolean source

Sets the current log level.

Params:

NameTypeAttributeDescription
level string

log level

Return:

boolean

public setLogger(context: string, logger: *) source

Sets the logger for the give context.

Params:

NameTypeAttributeDescription
context string

The context to set.

logger *

The logger to set.

public trace() source

Dispatch to the logger->trace if it exists and the log level is enabled.

public warn() source

Dispatch to the logger->warn if it exists and the log level is enabled.