mirror of
https://github.com/giongto35/cloud-game.git
synced 2026-01-23 18:46:11 +00:00
* Initial new frontend rewrite * Refactor some module deps * Fix options ref in the ajax module * Refactor * Add controller state * Refactor
21 lines
598 B
JavaScript
Vendored
21 lines
598 B
JavaScript
Vendored
const log = (() => {
|
|
let level = 'info';
|
|
const levels = {'trace': 0, 'debug': 1, 'error': 2, 'info': 3};
|
|
|
|
const atLeast = (lv) => (levels[lv] || -1) >= levels[level];
|
|
|
|
return {
|
|
info: function () {
|
|
atLeast('info') && console.info.apply(null, arguments)
|
|
},
|
|
debug: function () {
|
|
atLeast('debug') && console.debug.apply(null, arguments)
|
|
},
|
|
error: function () {
|
|
atLeast('error') && console.error.apply(null, arguments)
|
|
},
|
|
setLevel: (level_) => {
|
|
level = level_
|
|
}
|
|
}
|
|
})();
|