-
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
58 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import debug from 'debug'; | ||
|
||
const APP_NAME = 'mediasoup-client-aiortc'; | ||
|
||
export class Logger | ||
{ | ||
private readonly _debug: debug.Debugger; | ||
private readonly _warn: debug.Debugger; | ||
private readonly _error: debug.Debugger; | ||
|
||
constructor(prefix?: string) | ||
{ | ||
if (prefix) | ||
{ | ||
this._debug = debug(`${APP_NAME}:${prefix}`); | ||
this._warn = debug(`${APP_NAME}:WARN:${prefix}`); | ||
this._error = debug(`${APP_NAME}:ERROR:${prefix}`); | ||
} | ||
else | ||
{ | ||
this._debug = debug(APP_NAME); | ||
this._warn = debug(`${APP_NAME}:WARN`); | ||
this._error = debug(`${APP_NAME}:ERROR`); | ||
} | ||
|
||
/* eslint-disable no-console */ | ||
this._debug.log = console.info.bind(console); | ||
this._warn.log = console.warn.bind(console); | ||
this._error.log = console.error.bind(console); | ||
/* eslint-enable no-console */ | ||
} | ||
|
||
get debug(): debug.Debugger | ||
{ | ||
return this._debug; | ||
} | ||
|
||
get warn(): debug.Debugger | ||
{ | ||
return this._warn; | ||
} | ||
|
||
get error(): debug.Debugger | ||
{ | ||
return this._error; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters