forked from EFForg/https-everywhere
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutil.js
More file actions
27 lines (24 loc) · 838 Bytes
/
util.js
File metadata and controls
27 lines (24 loc) · 838 Bytes
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
"use strict";
var VERB = 1;
var DBUG = 2;
var INFO = 3;
var NOTE = 4;
var WARN = 5;
// FYI: Logging everything is /very/ slow. Chrome will log & buffer
// these console logs even when the debug tools are closed. :(
// TODO: Add an easy UI to change the log level.
// (Developers can just type DEFAULT_LOG_LEVEL=VERB in the console)
var DEFAULT_LOG_LEVEL = NOTE;
console.log("Hey developer! Want to see more verbose logging?");
console.log("Type this into the console: DEFAULT_LOG_LEVEL=VERB");
console.log("Accepted levels are VERB, DBUG, INFO, NOTE and WARN, default is NOTE");
function log(level, str) {
if (level >= DEFAULT_LOG_LEVEL) {
if (level === WARN) {
// Show warning with a little yellow icon in Chrome.
console.warn(str);
} else {
console.log(str);
}
}
}