mirror of
https://github.com/giongto35/cloud-game.git
synced 2026-01-23 02:34:42 +00:00
These modules should be supported by all contemporary browsers, and this transition should resolve most issues related to the explicit import order of the .js files.
31 lines
844 B
JavaScript
31 lines
844 B
JavaScript
const noop = () => ({})
|
|
|
|
const _log = {
|
|
ASSERT: 1,
|
|
ERROR: 2,
|
|
WARN: 3,
|
|
INFO: 4,
|
|
DEBUG: 5,
|
|
TRACE: 6,
|
|
|
|
DEFAULT: 5,
|
|
|
|
set level(level) {
|
|
this.assert = level >= this.ASSERT ? console.assert.bind(window.console) : noop;
|
|
this.error = level >= this.ERROR ? console.error.bind(window.console) : noop;
|
|
this.warn = level >= this.WARN ? console.warn.bind(window.console) : noop;
|
|
this.info = level >= this.INFO ? console.info.bind(window.console) : noop;
|
|
this.debug = level >= this.DEBUG ? console.debug.bind(window.console) : noop;
|
|
this.trace = level >= this.TRACE ? console.log.bind(window.console) : noop;
|
|
this._level = level;
|
|
},
|
|
get level() {
|
|
return this._level;
|
|
}
|
|
}
|
|
_log.level = _log.DEFAULT;
|
|
|
|
/**
|
|
* Logging module.
|
|
*/
|
|
export const log = _log
|