Add LiveQuery
This commit is contained in:
41
src/LiveQuery/PLog.js
Normal file
41
src/LiveQuery/PLog.js
Normal file
@@ -0,0 +1,41 @@
|
||||
let LogLevel = {
|
||||
'VERBOSE': 0,
|
||||
'DEBUG': 1,
|
||||
'INFO': 2,
|
||||
'ERROR': 3,
|
||||
'NONE': 4
|
||||
}
|
||||
|
||||
function getCurrentLogLevel() {
|
||||
if (PLog.logLevel && PLog.logLevel in LogLevel) {
|
||||
return LogLevel[PLog.logLevel];
|
||||
}
|
||||
return LogLevel['ERROR'];
|
||||
}
|
||||
|
||||
function verbose(): void {
|
||||
if (getCurrentLogLevel() <= LogLevel['VERBOSE']) {
|
||||
console.log.apply(console, arguments)
|
||||
}
|
||||
}
|
||||
|
||||
function log(): void {
|
||||
if (getCurrentLogLevel() <= LogLevel['INFO']) {
|
||||
console.log.apply(console, arguments)
|
||||
}
|
||||
}
|
||||
|
||||
function error(): void {
|
||||
if (getCurrentLogLevel() <= LogLevel['ERROR']) {
|
||||
console.error.apply(console, arguments)
|
||||
}
|
||||
}
|
||||
|
||||
let PLog = {
|
||||
log: log,
|
||||
error: error,
|
||||
verbose: verbose,
|
||||
logLevel: 'INFO'
|
||||
};
|
||||
|
||||
module.exports = PLog;
|
||||
Reference in New Issue
Block a user