Skip to content

Class: Logger

A class which allows log events to be subscribed to.

Methods

off()

ts
off<K>(event: Key<K, LogBusEventMap>, listener?: Listener<K, LogBusEventMap>): this;

Unsubscribe from a log event.

Type Parameters

Type ParameterDescription
KThe level of the log to stop listen to

Parameters

ParameterTypeDescription
eventKey<K, LogBusEventMap>The level of the log to stop listen to
listener?Listener<K, LogBusEventMap>The callback to be unsubscribed from the log event

Returns

this


on()

ts
on<K>(
   event: Key<K, LogBusEventMap>,
   listener: Listener<K, LogBusEventMap>,
   ctx?: any): this;

Subscribe to a log event.

Type Parameters

Type ParameterDescription
KThe level of the log to listen to

Parameters

ParameterTypeDescription
eventKey<K, LogBusEventMap>The level of the log to listen to
listenerListener<K, LogBusEventMap>The callback to be called when the log is created
ctx?anyThe this context to be used when calling the callback

Returns

this


once()

ts
once<K>(
   event: Key<K, LogBusEventMap>,
   listener: Listener<K, LogBusEventMap>,
   ctx?: any): this;

Subscribe to a log event once.

Type Parameters

Type ParameterDescription
KThe level of the log to listen to

Parameters

ParameterTypeDescription
eventKey<K, LogBusEventMap>The level of the log to listen to
listenerListener<K, LogBusEventMap>The callback to be called when the log is created
ctx?anyThe this context to be used when calling the callback

Returns

this


subscribe()

ts
subscribe<K>(
   event: Key<K, LogBusEventMap>,
   listener: Listener<K, LogBusEventMap>,
   ctx?: any): this;

Subscribe to log events with a severity level greater than or equal to the specified level.

Type Parameters

Type ParameterDescription
KThe level of the log to listen to

Parameters

ParameterTypeDescription
eventKey<K, LogBusEventMap>The level of the log to listen to
listenerListener<K, LogBusEventMap>The callback to be called when the log is created
ctx?anyThe this context to be used when calling the callback

Returns

this

Remarks

See Severities for the list of available log levels and their numeric equivalents.


subscribeOnce()

ts
subscribeOnce<K>(
   event: Key<K, LogBusEventMap>,
   listener: Listener<K, LogBusEventMap>,
   ctx?: any): this;

Subscribe to log events with a severity level greater than or equal to the specified level once.

Type Parameters

Type ParameterDescription
KThe level of the log to listen to

Parameters

ParameterTypeDescription
eventKey<K, LogBusEventMap>The level of the log to listen to
listenerListener<K, LogBusEventMap>The callback to be called when the log is created
ctx?anyThe this context to be used when calling the callback

Returns

this

Remarks

See Severities for the list of available log levels and their numeric equivalents.


unsubscribe()

ts
unsubscribe<K>(event: Key<K, LogBusEventMap>, listener: Listener<K, LogBusEventMap>): this;

Unsubscribe from log events with a severity level greater than or equal to the specified level once.

Type Parameters

Type ParameterDescription
KThe level of the log to top listen to

Parameters

ParameterTypeDescription
eventKey<K, LogBusEventMap>The minimum level of the log to stop listening to
listenerListener<K, LogBusEventMap>The callback to be unsubscribed from the log event

Returns

this

Remarks

See Severities for the list of available log levels and their numeric equivalents.