forked from HumanSecurity/restringer
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdebugHelper.js
More file actions
19 lines (17 loc) · 837 Bytes
/
debugHelper.js
File metadata and controls
19 lines (17 loc) · 837 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/**
* Debugging helper
* Set the environment variable DEOBDEBUG='true' to print out debug messages and save output as file
* Default behavior is to suppress debug messages and output deobfuscated code to standard output
* Debug mode can also be enabled from the outer scope when this module is being imported
*/
const DEBUGMODEON = process.env.DEOBDEBUG === 'true' || false;
const defaultDebugLevel = 50;
let DEBUGLEVEL = process.env.DEOBDEBUGLEVEL || defaultDebugLevel; // The lower the number the more verbose it is
const debugLog = (msg, level = defaultDebugLevel) => DEBUGMODEON && level >= DEBUGLEVEL ? console.log(msg) : undefined;
const debugErr = (msg, level = defaultDebugLevel) => DEBUGMODEON && level >= DEBUGLEVEL ? console.error(msg) : undefined;
module.exports = {
DEBUGMODEON,
DEBUGLEVEL,
debugLog,
debugErr,
};