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 |
|
public |
error() Dispatch to the |
|
public |
fatal() Dispatch to the |
|
public |
getContext(): string | * Get the current context. |
|
public |
getLogLevel(): * 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 |
|
public |
isLevelEnabled(level: string): boolean Returns whether the given log level is enabled. |
|
public |
Posts a log message given a log level and parameters. |
|
public |
removeLogger(context: *) Removes the logger by the given context. |
|
public |
setContext(context: string): boolean Sets the current context |
|
public |
setLogLevel(level: string): boolean Sets the current log level. |
|
public |
Sets the logger for the give context. |
|
public |
trace() Dispatch to the |
|
public |
warn() Dispatch to the |
Public Constructors
Public Methods
public getLogger(context: *): * source
Get the logger by the given context.
Params:
Name | Type | Attribute | Description |
context | * | the context to use for logger retrieval. |
Return:
* |
public hasContext(context: *): * source
Returns whether a logger is defined by the given context.
Params:
Name | Type | Attribute | Description |
context | * | the context to check. |
Return:
* |
public isLevelEnabled(level: string): boolean source
Returns whether the given log level is enabled.
Params:
Name | Type | Attribute | Description |
level | string | log level |
public post(level: string, params: *) source
Posts a log message given a log level and parameters.
Params:
Name | Type | Attribute | Description |
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:
Name | Type | Attribute | Description |
context | * | The context to check. |
public setContext(context: string): boolean source
Sets the current context
Params:
Name | Type | Attribute | Description |
context | string | The context to set. |
public setLogLevel(level: string): boolean source
Sets the current log level.
Params:
Name | Type | Attribute | Description |
level | string | log level |