pass optional logger instance to constructor.

This commit is contained in:
Miroslav Šedivý 2021-09-09 23:47:39 +02:00
parent ce88143903
commit f067fe9d62
3 changed files with 6 additions and 6 deletions

View File

@ -46,10 +46,10 @@ export class NekoMessages extends EventEmitter<NekoEvents> {
private _state: NekoState
private _log: Logger
constructor(connection: NekoConnection, state: NekoState) {
constructor(connection: NekoConnection, state: NekoState, logger?: Logger) {
super()
this._log = new Logger('messages')
this._log = logger || new Logger('messages')
this._state = state
this._connection = connection

View File

@ -36,10 +36,10 @@ export class NekoWebRTC extends EventEmitter<NekoWebRTCEvents> {
private _log: Logger
private _statsStop?: () => void
constructor() {
constructor(logger?: Logger) {
super()
this._log = new Logger('webrtc')
this._log = logger || new Logger('webrtc')
}
get supported() {

View File

@ -11,10 +11,10 @@ export class NekoWebSocket extends EventEmitter<NekoWebSocketEvents> {
private _ws?: WebSocket
private _log: Logger
constructor() {
constructor(logger?: Logger) {
super()
this._log = new Logger('websocket')
this._log = logger || new Logger('websocket')
}
get supported() {