forked from playcanvas/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlog.js
More file actions
107 lines (97 loc) · 2.88 KB
/
Copy pathlog.js
File metadata and controls
107 lines (97 loc) · 2.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
Object.assign(pc, function () {
var log = {
/**
* @private
* @function
* @name pc.log.write
* @description Write text to the console
* @param {String} text The text to log.
*/
write: function (text) {
console.log(text);
},
/**
* @private
* @function
* @name pc.log.open
* @description Starting logging to the console
*/
open: function () {
pc.log.write("Powered by PlayCanvas " + pc.version + " " + pc.revision);
},
/**
* @private
* @function
* @name pc.log.info
* @description Write text to the log preceded by 'INFO:'
* @param {String} text The text to log.
*/
info: function (text) {
console.info("INFO: " + text);
},
/**
* @private
* @function
* @name pc.log.debug
* @description Write text to the log preceded by 'DEBUG:'
* @param {String} text The text to log.
*/
debug: function (text) {
console.debug("DEBUG: " + text);
},
/**
* @private
* @function
* @name pc.log.error
* @description Write text to the log preceded by 'ERROR:'
* @param {String} text The text to log.
*/
error: function (text) {
console.error("ERROR: " + text);
},
/**
* @private
* @function
* @name pc.log.warning
* @description Write text to the log preceded by 'WARNING:'
* @param {String} text The text to log.
*/
warning: function (text) {
console.warn("WARNING: " + text);
},
/**
* @private
* @function
* @name pc.log.alert
* @description Write text to the log preceded by 'ALERT:' and pop up an alert dialog box with the text
* @param {String} text The text to show in the alert.
*/
alert: function (text) {
pc.log.write("ALERT: " + text);
alert(text);
},
/**
* @private
* @function
* @name pc.log.assert
* @description If condition is false, then write text to the log preceded by 'ASSERT:'.
* @param {Boolean} condition The condition to test.
* @param {String} text The text to show if the condition is false.
*/
assert: function (condition, text) {
if (condition === false) {
pc.log.write("ASSERT: " + text);
}
}
};
return {
log: log
};
}());
// Shortcuts to logging functions
var logINFO = pc.log.info;
var logDEBUG = pc.log.debug;
var logWARNING = pc.log.warning;
var logERROR = pc.log.error;
var logALERT = pc.log.alert;
var logASSERT = pc.log.assert;