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 Parameter | Description |
|---|---|
K | The level of the log to stop listen to |
Parameters
| Parameter | Type | Description |
|---|---|---|
event | Key<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 Parameter | Description |
|---|---|
K | The level of the log to listen to |
Parameters
| Parameter | Type | Description |
|---|---|---|
event | Key<K, LogBusEventMap> | The level of the log to listen to |
listener | Listener<K, LogBusEventMap> | The callback to be called when the log is created |
ctx? | any | The 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 Parameter | Description |
|---|---|
K | The level of the log to listen to |
Parameters
| Parameter | Type | Description |
|---|---|---|
event | Key<K, LogBusEventMap> | The level of the log to listen to |
listener | Listener<K, LogBusEventMap> | The callback to be called when the log is created |
ctx? | any | The 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 Parameter | Description |
|---|---|
K | The level of the log to listen to |
Parameters
| Parameter | Type | Description |
|---|---|---|
event | Key<K, LogBusEventMap> | The level of the log to listen to |
listener | Listener<K, LogBusEventMap> | The callback to be called when the log is created |
ctx? | any | The 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 Parameter | Description |
|---|---|
K | The level of the log to listen to |
Parameters
| Parameter | Type | Description |
|---|---|---|
event | Key<K, LogBusEventMap> | The level of the log to listen to |
listener | Listener<K, LogBusEventMap> | The callback to be called when the log is created |
ctx? | any | The 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 Parameter | Description |
|---|---|
K | The level of the log to top listen to |
Parameters
| Parameter | Type | Description |
|---|---|---|
event | Key<K, LogBusEventMap> | The minimum level of the log to stop listening to |
listener | Listener<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.