Logger
Type parameters
▪ T: SuperConstructor
▪ T: SuperConstructor
Hierarchy
SuperPrototypeSelector‹StatefulMixin | RFC5424LoggingMixin, this› & StatefulMixin‹this› & RFC5424LoggingMixin‹this›
SuperPrototypeSelector‹StatefulMixin | RFC5424LoggingMixin, this› & StatefulMixin‹this› & RFC5424LoggingMixin‹this›
↳ Logger
Implements
Index
Constructors
Properties
Methods
- alert
 - crit
 - debug
 - emerg
 - error
 - getPriority
 - getSelectableStates
 - getState
 - getTransport
 - getTransports
 - hasState
 - hasTransport
 - info
 - isInOneOfStates
 - isInState
 - isRunning
 - isStopped
 - log
 - notice
 - overrideTransport
 - registerTransport
 - removeTransport
 - setState
 - start
 - stop
 - validateState
 - warning
 
Constructors
constructor
+ new Logger(levels?: LogLevels): Logger
Creates an instance of Logger. Creates an instance of Logger.
Parameters:
| Name | Type | Description | 
|---|---|---|
levels? | LogLevels | Logging 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:
| Name | Type | 
|---|---|
entry | string | LogEntry | 
...args | any[] | 
Returns: void
crit
▸ crit(entry: string | LogEntry, ...args: any[]): void
Implementation of Logger
Inherited from RFC5424LoggingMixin.crit
Overrides void
Parameters:
| Name | Type | 
|---|---|
entry | string | LogEntry | 
...args | any[] | 
Returns: void
debug
▸ debug(entry: string | LogEntry, ...args: any[]): void
Implementation of Logger
Inherited from RFC5424LoggingMixin.debug
Overrides void
Parameters:
| Name | Type | 
|---|---|
entry | string | LogEntry | 
...args | any[] | 
Returns: void
emerg
▸ emerg(entry: string | LogEntry, ...args: any[]): void
Implementation of Logger
Inherited from RFC5424LoggingMixin.emerg
Overrides void
Parameters:
| Name | Type | 
|---|---|
entry | string | LogEntry | 
...args | any[] | 
Returns: void
error
▸ error(entry: string | LogEntry, ...args: any[]): void
Implementation of Logger
Inherited from RFC5424LoggingMixin.error
Overrides void
Parameters:
| Name | Type | 
|---|---|
entry | string | LogEntry | 
...args | any[] | 
Returns: void
getPriority
▸ getPriority(level: LogLevel): number
Implementation of Logger
Returns logging level priority.
Parameters:
| Name | Type | Description | 
|---|---|---|
level | LogLevel | Level 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
Returns: State
getTransport
▸ getTransport(id: string): LogTransport | undefined
Implementation of Logger
Returns transport.
Parameters:
| Name | Type | Description | 
|---|---|---|
id | string | Identifier 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
Returns: boolean
hasTransport
▸ hasTransport(id: string): boolean
Implementation of Logger
Evaluates if transport is registered on logger.
Parameters:
| Name | Type | Description | 
|---|---|---|
id | string | Identifier 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:
| Name | Type | 
|---|---|
entry | string | LogEntry | 
...args | any[] | 
Returns: void
isInOneOfStates
▸ isInOneOfStates(states: State | State[]): boolean
Implementation of Logger
Inherited from StatefulMixin.isInOneOfStates
Overrides Task.isInOneOfStates
Parameters:
| Name | Type | 
|---|---|
states | State | State[] | 
Returns: boolean
isInState
▸ isInState(state: State | State[]): boolean
Implementation of Logger
Inherited from StatefulMixin.isInState
Parameters:
| Name | Type | 
|---|---|
state | State | 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:
| Name | Type | Description | 
|---|---|---|
level | LogLevel | Supported logging level by logging transport. | 
entry | string | LogEntry | Logging entry as a string or instance implementing LogEntry interface. | 
...args | any[] | 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:
| Name | Type | 
|---|---|
entry | string | LogEntry | 
...args | any[] | 
Returns: void
overrideTransport
▸ overrideTransport(id: string, transport: LogTransport): void
Implementation of Logger
Override existing transport.
Parameters:
| Name | Type | Description | 
|---|---|---|
id | string | Identifier for the transport. | 
transport | LogTransport | Instance 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:
| Name | Type | Description | 
|---|---|---|
id | string | Identifier for the transport. | 
transport | LogTransport | Instance implementing LogTransport interface. | 
shouldOverride? | boolean | Flag indicating that transport should be overridden. | 
Returns: void
removeTransport
▸ removeTransport(id: string): void
Implementation of Logger
Removes transport from logger's transports.
Parameters:
| Name | Type | Description | 
|---|---|---|
id | string | Identifier for the transport. | 
Returns: void
setState
▸ setState(state: State): void
Implementation of Logger
Inherited from StatefulMixin.setState
Parameters:
| Name | Type | 
|---|---|
state | State | 
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:
| Name | Type | 
|---|---|
stateOrStates | State | State[] | 
error? | Error | 
Returns: boolean
warning
▸ warning(entry: string | LogEntry, ...args: any[]): void
Implementation of Logger
Inherited from RFC5424LoggingMixin.warning
Overrides void
Parameters:
| Name | Type | 
|---|---|
entry | string | LogEntry | 
...args | any[] | 
Returns: void