11cb0ef41Sopenharmony_cilet messages = []; 21cb0ef41Sopenharmony_cilet level = 0; 31cb0ef41Sopenharmony_ci 41cb0ef41Sopenharmony_ciconst debug = (msg, min) => { 51cb0ef41Sopenharmony_ci if (level >= min) { 61cb0ef41Sopenharmony_ci messages.push(msg); 71cb0ef41Sopenharmony_ci } 81cb0ef41Sopenharmony_ci}; 91cb0ef41Sopenharmony_ci 101cb0ef41Sopenharmony_cidebug.WARN = 1; 111cb0ef41Sopenharmony_cidebug.INFO = 2; 121cb0ef41Sopenharmony_cidebug.DEBUG = 3; 131cb0ef41Sopenharmony_ci 141cb0ef41Sopenharmony_cidebug.reset = () => { 151cb0ef41Sopenharmony_ci messages = []; 161cb0ef41Sopenharmony_ci}; 171cb0ef41Sopenharmony_ci 181cb0ef41Sopenharmony_cidebug.setDebugLevel = (v) => { 191cb0ef41Sopenharmony_ci level = v; 201cb0ef41Sopenharmony_ci}; 211cb0ef41Sopenharmony_ci 221cb0ef41Sopenharmony_cidebug.warn = (msg) => debug(msg, debug.WARN); 231cb0ef41Sopenharmony_cidebug.info = (msg) => debug(msg, debug.INFO); 241cb0ef41Sopenharmony_cidebug.debug = (msg) => debug(msg, debug.DEBUG); 251cb0ef41Sopenharmony_ci 261cb0ef41Sopenharmony_cidebug.debugMessages = () => messages; 271cb0ef41Sopenharmony_ci 281cb0ef41Sopenharmony_cimodule.exports = debug; 29