mirror of
https://github.com/giongto35/cloud-game.git
synced 2026-07-18 09:06:00 +00:00
* Add the initial support for settings * Rearrange init order for the settings and log modules * Add import settings function * Add initial settings display panel * Add settings controls * Add settings controls handlers * Add garbage gui auto-builder for settings * Add some custom binding handlers for settings * Add super ineffective ¯\_(ツ)_/¯ keyboard bindings remap function * Migrate keyboard to codes instead deprecated keyCodes * Abort key remap on Esc Co-authored-by: Sergey Stepanov <sergystepanov@gmail.com>
26 lines
784 B
JavaScript
Vendored
26 lines
784 B
JavaScript
Vendored
const log = (() => {
|
|
const levels = {'trace': 0, 'debug': 1, 'error': 2, 'warning': 3, 'info': 4};
|
|
let level = -1;
|
|
|
|
const atLeast = lv => (lv || -1) >= level;
|
|
|
|
return {
|
|
level: levels,
|
|
info: function () {
|
|
atLeast(levels.info) && console.info.apply(null, arguments)
|
|
},
|
|
debug: function () {
|
|
atLeast(levels.debug) && console.debug.apply(null, arguments)
|
|
},
|
|
error: function () {
|
|
console.error.apply(null, arguments)
|
|
},
|
|
warning: function () {
|
|
atLeast(levels.warning) && console.warn.apply(null, arguments)
|
|
},
|
|
setLevel: (level_) => {
|
|
level = levels[level_] || -1;
|
|
},
|
|
is: (level_) => level === level_
|
|
}
|
|
})(console);
|