@absolunet/ioc2.1.0

View on GitHub

Logger

Logger service that exposes log methods representing levels. It forwards the log to the configured driver.

Extends

Members

(static) dependencies :Array.<string>

Source:
Class dependencies: ['app', 'config', log.level'].

LEVEL :log.enums.Level

Source:
Log level enum.

fallbackChannel :string

Source:
The fallback channel.

Methods

(async) emergency(message, contextopt)

Source:
Log emergency message.
Parameters:
Name Type Attributes Description
message string The message.
context * <optional>
The context.
Returns:
The async process promise.
Type
Promise

(async) alert(message, contextopt)

Source:
Log alert message.
Parameters:
Name Type Attributes Description
message string The message.
context * <optional>
The context.
Returns:
The async process promise.
Type
Promise

(async) critical(message, contextopt)

Source:
Log critical message.
Parameters:
Name Type Attributes Description
message string The message.
context * <optional>
The context.
Returns:
The async process promise.
Type
Promise

(async) error(message, contextopt)

Source:
Log error message.
Parameters:
Name Type Attributes Description
message string The message.
context * <optional>
The context.
Returns:
The async process promise.
Type
Promise

(async) warning(message, contextopt)

Source:
Log warning message.
Parameters:
Name Type Attributes Description
message string The message.
context * <optional>
The context.
Returns:
The async process promise.
Type
Promise

(async) notice(message, contextopt)

Source:
Log notice message.
Parameters:
Name Type Attributes Description
message string The message.
context * <optional>
The context.
Returns:
The async process promise.
Type
Promise

(async) info(message, contextopt)

Source:
Log info message.
Parameters:
Name Type Attributes Description
message string The message.
context * <optional>
The context.
Returns:
The async process promise.
Type
Promise

(async) debug(message, contextopt)

Source:
Log debug message.
Parameters:
Name Type Attributes Description
message string The message.
context * <optional>
The context.
Returns:
The async process promise.
Type
Promise

(async) log(level, message, contextopt)

Source:
Log message with default channel.
Parameters:
Name Type Attributes Description
level number The log level.
message string The message.
context * <optional>
The context.
Returns:
The async process promise.
Type
Promise

(async) logWithChannel(channel, level, message, contextopt)

Source:
Log message with the given channel by name. Catches errors.
Parameters:
Name Type Attributes Description
channel string The channel to use.
level number The log level.
message string The message.
context * <optional>
The context.
Returns:
The async process promise.
Type
Promise

(async) unsafeLogWithChannel(channel, level, message, contextopt)

Source:
Log message with the given channel by name. Does not catch errors.
Parameters:
Name Type Attributes Description
channel string The channel to use.
level number The log level.
message string The message.
context * <optional>
The context.
Throws:
Indicates that the log channel was not found.
Type
TypeError
Returns:
The async process promise.
Type
Promise

(async) logWithDefaultChannel(level, message, contextopt)

Source:
Log with default channel.
Parameters:
Name Type Attributes Description
level number The log level.
message string The message.
context * <optional>
The context.
Returns:
The async process promise.
Type
Promise

(async) logWithFallbackChannel(level, message, contextopt)

Source:
Log with fallback channel.
Parameters:
Name Type Attributes Description
level number The log level.
message string The message.
context * <optional>
The context.
Returns:
The async process promise.
Type
Promise

isLevelUnderThreshold(level, thresholdopt)

Source:
Check if the given level is under the given level threshold.
Parameters:
Name Type Attributes Default Description
level string | number The level to evaluate.
threshold string | number <optional>
0 The threshold.
Returns:
Indicates that the given level is under the given threshold.
Type
boolean

getLevelValue(level)

Source:
Get parsed level value from either the number value or the verbose string.
Parameters:
Name Type Description
level string | number The level.
Returns:
The level value as integer.
Type
number

setFallbackChannel(channel)

Source:
Set default channel.
Parameters:
Name Type Description
channel string The fallback channel name.

driver(nameopt, parametersopt)

Source:
Inherited From:
Get loader driver by name.
Parameters:
Name Type Attributes Default Description
name string <optional>
"default" The driver name.
parameters object <optional>
{} The additional parameters to inject into the driver instance.
Returns:
The resolved driver instance.
Type
object

bootDriver(driver, name)

Source:
Inherited From:
Boot newly created driver.
Parameters:
Name Type Description
driver * The driver instance.
name string The driver name.
Returns:
The driver instance.
Type
*

addDriver(name, driver)

Source:
Inherited From:
Add a driver and bind it with the given name.
Parameters:
Name Type Description
name string The driver name.
driver function The driver class or factory.

setDefaultDriver(name)

Source:
Inherited From:
Set given driver name as the default driver.
Parameters:
Name Type Description
name string The driver name.

setDriverAlias(name, alias)

Source:
Inherited From:
Give driver an alias name.
Parameters:
Name Type Description
name string The driver name.
alias string The driver alias.

hasDriver(name)

Source:
Inherited From:
Check if driver exists.
Parameters:
Name Type Description
name string The driver name.
Returns:
Indicates that the driver exists.
Type
boolean

isDriverAlias(name)

Source:
Inherited From:
Check if given driver name is an alias.
Parameters:
Name Type Description
name string The driver alias name.
Returns:
Indicates that the alias exists.
Type
boolean