Logger

Type parameters

T: SuperConstructor

T: SuperConstructor

Hierarchy

Implements

Index

Constructors

Properties

Methods

Constructors

constructor

+ new Logger(levels?: LogLevels): Logger

Creates an instance of Logger. Creates an instance of Logger.

Parameters:

NameTypeDescription
levels?LogLevelsLogging levels for logger.

Returns: Logger

Properties

Readonly levels

levels: LogLevels

Implementation of Logger.levels


state

state: State

Implementation of Logger.state

Inherited from StatefulMixin.state

Overrides void


Static STATES

STATES: STATES = STATES

Methods

alert

alert(entry: string | LogEntry, ...args: any[]): void

Implementation of Logger

Inherited from RFC5424LoggingMixin.alert

Overrides void

Parameters:

NameType
entrystring | LogEntry
...argsany[]

Returns: void


crit

crit(entry: string | LogEntry, ...args: any[]): void

Implementation of Logger

Inherited from RFC5424LoggingMixin.crit

Overrides void

Parameters:

NameType
entrystring | LogEntry
...argsany[]

Returns: void


debug

debug(entry: string | LogEntry, ...args: any[]): void

Implementation of Logger

Inherited from RFC5424LoggingMixin.debug

Overrides void

Parameters:

NameType
entrystring | LogEntry
...argsany[]

Returns: void


emerg

emerg(entry: string | LogEntry, ...args: any[]): void

Implementation of Logger

Inherited from RFC5424LoggingMixin.emerg

Overrides void

Parameters:

NameType
entrystring | LogEntry
...argsany[]

Returns: void


error

error(entry: string | LogEntry, ...args: any[]): void

Implementation of Logger

Inherited from RFC5424LoggingMixin.error

Overrides void

Parameters:

NameType
entrystring | LogEntry
...argsany[]

Returns: void


getPriority

getPriority(level: LogLevel): number

Implementation of Logger

Returns logging level priority.

Parameters:

NameTypeDescription
levelLogLevelLevel name.

Returns: number

Logging level priority as number.


getSelectableStates

getSelectableStates(): Record‹string, State

Implementation of Logger

Inherited from StatefulMixin.getSelectableStates

Overrides Task.getSelectableStates

Returns: Record‹string, State


getState

getState(): State

Implementation of Logger

Inherited from StatefulMixin.getState

Overrides Task.getState

Returns: State


getTransport

getTransport(id: string): LogTransport | undefined

Implementation of Logger

Returns transport.

Parameters:

NameTypeDescription
idstringIdentifier for the transport.

Returns: LogTransport | undefined

Logging transport as instance implementing LogTransport interface.


getTransports

getTransports(): Map‹string, LogTransport

Implementation of Logger

Returns all transport mappings on logger.

Returns: Map‹string, LogTransport

Mappings of all registered transports.


hasState

hasState(): boolean

Implementation of Logger

Inherited from StatefulMixin.hasState

Overrides Task.hasState

Returns: boolean


hasTransport

hasTransport(id: string): boolean

Implementation of Logger

Evaluates if transport is registered on logger.

Parameters:

NameTypeDescription
idstringIdentifier for the transport.

Returns: boolean

Returns true if logger has transport registered, else false.


info

info(entry: string | LogEntry, ...args: any[]): void

Implementation of Logger

Inherited from RFC5424LoggingMixin.info

Overrides void

Parameters:

NameType
entrystring | LogEntry
...argsany[]

Returns: void


isInOneOfStates

isInOneOfStates(states: State | State[]): boolean

Implementation of Logger

Inherited from StatefulMixin.isInOneOfStates

Overrides Task.isInOneOfStates

Parameters:

NameType
statesState | State[]

Returns: boolean


isInState

isInState(state: State | State[]): boolean

Implementation of Logger

Inherited from StatefulMixin.isInState

Overrides Task.isInState

Parameters:

NameType
stateState | State[]

Returns: boolean


isRunning

isRunning(): boolean

Implementation of Logger

Evaluates if logger is running.

Returns: boolean

Returns true if logger is in 'running' state, else false.


isStopped

isStopped(): boolean

Implementation of Logger

Evaluates if logger is stopped.

Returns: boolean

Returns true if logger is not in running state, else false.


log

log(level: LogLevel, entry: string | LogEntry, ...args: any[]): void

Implementation of Logger

Overrides RFC5424LoggingMixin.log

Logs message for level.

Parameters:

NameTypeDescription
levelLogLevelSupported logging level by logging transport.
entrystring | LogEntryLogging entry as a string or instance implementing LogEntry interface.
...argsany[]Any other arguments that will be attached to log entry.

Returns: void


notice

notice(entry: string | LogEntry, ...args: any[]): void

Implementation of Logger

Inherited from RFC5424LoggingMixin.notice

Overrides void

Parameters:

NameType
entrystring | LogEntry
...argsany[]

Returns: void


overrideTransport

overrideTransport(id: string, transport: LogTransport): void

Implementation of Logger

Override existing transport.

Parameters:

NameTypeDescription
idstringIdentifier for the transport.
transportLogTransportInstance implementing LogTransport interface.

Returns: void


registerTransport

registerTransport(id: string, transport: LogTransport, shouldOverride?: boolean): void

Implementation of Logger

Registers logging transport.

throws {InvalidTransportIdError} Thrown if the id argument is not a string.

throws {TransportExistsError} Thrown if the transport would override existing one.

Parameters:

NameTypeDescription
idstringIdentifier for the transport.
transportLogTransportInstance implementing LogTransport interface.
shouldOverride?booleanFlag indicating that transport should be overridden.

Returns: void


removeTransport

removeTransport(id: string): void

Implementation of Logger

Removes transport from logger's transports.

Parameters:

NameTypeDescription
idstringIdentifier for the transport.

Returns: void


setState

setState(state: State): void

Implementation of Logger

Inherited from StatefulMixin.setState

Overrides Task.setState

Parameters:

NameType
stateState

Returns: void


start

start(): void

Implementation of Logger

Starts logging.

throws {InvalidStateError} Thrown if logger is not in one of valid states: 'constructed' or 'stopped'.

Returns: void


stop

stop(): void

Implementation of Logger

Stops logging.

Returns: void


validateState

validateState(stateOrStates: State | State[], error?: Error): boolean

Implementation of Logger

Inherited from StatefulMixin.validateState

Overrides Task.validateState

Parameters:

NameType
stateOrStatesState | State[]
error?Error

Returns: boolean


warning

warning(entry: string | LogEntry, ...args: any[]): void

Implementation of Logger

Inherited from RFC5424LoggingMixin.warning

Overrides void

Parameters:

NameType
entrystring | LogEntry
...argsany[]

Returns: void