@absolunet/ioc2.1.0

View on GitHub

FileDriver

Driver that logs into a file.

Extends

Members

(static) dependencies :Array.<string>

Source:
Class dependencies: ['app', 'file.engine', 'helper.file', 'log.level'].

fs :file.system.Async

Source:
The async file system.

config :object

Source:
Inherited From:
Driver configuration.

engine :*

Source:
Inherited From:
Current engine accessor.

Methods

getFullMessage(level, message)

Source:
Get full message to log.
Parameters:
Name Type Description
level number The log level.
message string The message.
Returns:
The full formatted message.
Type
string

getFormattedDate()

Source:
Get current formatted date.
Returns:
The formatted date.
Type
string

getFormattedLevel(level)

Source:
Get formatted level.
Parameters:
Name Type Description
level number The level value.
Returns:
The formatted level.
Type
string

getFormattedMessage(message)

Source:
Get formatted message with proper spacers.
Parameters:
Name Type Description
message string The message.
Returns:
The formatted message.
Type
string

getFormattedVersion()

Source:
Get formatted application version.
Returns:
The formatted application version.
Type
string

getLevelMaxLength()

Source:
Get maximum string length of available levels.
Returns:
The maximum length of all level in string version.
Type
number

getSpacer()

Source:
Get white space based on maximum level length.
Returns:
A spacer that covers the longest level string.
Type
string

ensureLimitIsUnderThreshold()

Source:
Ensure the configured file size limit is under the driver threshold. This will prevent memory leak if removing segment in a too large file.

(async) adjustFile()

Source:
Adjust file content to fit under the configured size limit.
Returns:
The async process promise.
Type
Promise

hasLimit()

Source:
Check if configuration has specified size limit.
Returns:
Indicates if a limit was set in the driver configuration.
Type
boolean

(async) log(level, message, contextopt)

Source:
Overrides:
Log message with context for a given level.
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

setConfig(config)

Source:
Inherited From:
Set configuration for the channel.
Parameters:
Name Type Description
config object The driver configuration.
Returns:
The current driver instance.
Type
log.services.Logger.drivers.Driver

setEngine(engine)

Source:
Inherited From:
Set current engine.
Parameters:
Name Type Description
engine * The engine instance.
Returns:
The current instance.
Type
support.mixins.HasEngine