@absolunet/ioc2.1.0

View on GitHub

DatabaseDriver

Driver that logs into a database table.

Extends

Members

(static) dependencies :Array.<string>

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

connection :Knex

Source:
The connection to use based on driver configuration.

config :object

Source:
Inherited From:
Driver configuration.

engine :*

Source:
Inherited From:
Current engine accessor.

Methods

(async) storeLog(level, message, contextopt)

Source:
Store log in database.
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) cleanPastLogs()

Source:
Clear past logs in the database, starting by the least recent ones.
Returns:
The async process promise.
Type
Promise

getFormattedLevel(level)

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

getFormattedVersion()

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

getFormattedMessage(message)

Source:
Get formatted message value.
Parameters:
Name Type Description
message string The original message.
Returns:
The formatted message.
Type
string

getFormattedCommand()

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

getFormattedContext(context)

Source:
Get formatted context by converting it into JSON.
Parameters:
Name Type Description
context * The context.
Returns:
The formatted context.
Type
string

(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