@urso/core 0.4.51 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/src/js/config/main.js
CHANGED
|
@@ -2,6 +2,7 @@ let ConfigMain = {
|
|
|
2
2
|
title: 'Urso', //game title
|
|
3
3
|
appVersion: 0, //app version, also used as anticache "appVersion=${appVersion}" when not 0
|
|
4
4
|
mode: "development", // development/production/testing
|
|
5
|
+
defaultLogLevel: 'ERROR,WARNING,INFO,LOG', //setup custom log level with: ?logLevel=1,2,3,4 OR ?logLevel=ERROR,WARNING,INFO,LOG
|
|
5
6
|
extendingChain: ['Urso.Core'], //chain that will be set as Urso.Game
|
|
6
7
|
defaultScene: 'play', //default scene to display
|
|
7
8
|
useBinPath: false, // use assets from bin directory
|
package/src/js/lib/logger.js
CHANGED
|
@@ -1,23 +1,69 @@
|
|
|
1
|
-
|
|
1
|
+
//setup custom log level with: ?logLevel=1,2,3,4 OR ?logLevel=ERROR,WARNING,INFO,LOG
|
|
2
|
+
|
|
3
|
+
const LEVELS = [
|
|
4
|
+
'ERROR',
|
|
5
|
+
'WARNING',
|
|
6
|
+
'INFO',
|
|
7
|
+
'LOG'
|
|
8
|
+
];
|
|
2
9
|
|
|
10
|
+
class LibLogger {
|
|
3
11
|
constructor() {
|
|
12
|
+
this._logLevel = {};
|
|
13
|
+
this._setupLevels();
|
|
14
|
+
|
|
4
15
|
//log
|
|
5
|
-
|
|
16
|
+
if (this._logLevel['LOG']) {
|
|
17
|
+
window.log = console.log.bind(console);
|
|
18
|
+
} else {
|
|
19
|
+
window.log = console.log = () => { }
|
|
20
|
+
}
|
|
6
21
|
}
|
|
7
22
|
|
|
8
23
|
//todo set log level (dev/prod)
|
|
9
24
|
|
|
10
25
|
log() {
|
|
26
|
+
if (!this._logLevel['LOG']) return;
|
|
27
|
+
|
|
11
28
|
console.log.apply(console, arguments);
|
|
12
29
|
}
|
|
13
30
|
|
|
31
|
+
info() {
|
|
32
|
+
if (!this._logLevel['INFO']) return;
|
|
33
|
+
|
|
34
|
+
console.info.apply(this, arguments);
|
|
35
|
+
}
|
|
36
|
+
|
|
14
37
|
warn() {
|
|
38
|
+
if (!this._logLevel['WARNING']) return;
|
|
39
|
+
|
|
15
40
|
console.warn.apply(this, arguments);
|
|
16
41
|
}
|
|
17
42
|
|
|
18
43
|
error() {
|
|
44
|
+
if (!this._logLevel['ERROR']) return;
|
|
45
|
+
|
|
19
46
|
console.error.apply(this, arguments);
|
|
20
47
|
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* setup logging levels
|
|
51
|
+
*/
|
|
52
|
+
_setupLevels() {
|
|
53
|
+
const logLevelsString = Urso.helper.parseGetParams('logLevel') || Urso.config.defaultLogLevel;
|
|
54
|
+
const logLevelsArray = logLevelsString.split(',');
|
|
55
|
+
|
|
56
|
+
for (const [index, level] of Object.entries(LEVELS)) {
|
|
57
|
+
let levelValue = false;
|
|
58
|
+
|
|
59
|
+
if (logLevelsArray.includes(index) || logLevelsArray.includes(level))
|
|
60
|
+
levelValue = true;
|
|
61
|
+
|
|
62
|
+
this._logLevel[level] = levelValue;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
console.log(`LibLogger log Level: ${JSON.stringify(this._logLevel)}`);
|
|
66
|
+
}
|
|
21
67
|
}
|
|
22
68
|
|
|
23
|
-
module.exports = LibLogger;
|
|
69
|
+
module.exports = LibLogger;
|
|
@@ -131,8 +131,11 @@ class ModulesScenesService {
|
|
|
131
131
|
//call all components create
|
|
132
132
|
this._sceneModel.create();
|
|
133
133
|
|
|
134
|
-
|
|
134
|
+
//reset display flag
|
|
135
135
|
this._displayInProgress = false;
|
|
136
|
+
|
|
137
|
+
//emit end of display event
|
|
138
|
+
this.emit(Urso.events.MODULES_SCENES_DISPLAY_FINISHED);
|
|
136
139
|
}
|
|
137
140
|
}
|
|
138
141
|
|