Add debug Level in cout
This commit is contained in:
parent
617a166bfb
commit
0a2cb47b06
2 changed files with 20 additions and 7 deletions
21
index.js
21
index.js
|
@ -45,11 +45,24 @@ function cin (question, hide) {
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
async function cout (string) {
|
class createCout {
|
||||||
|
constructor (debugLevel, logs) {
|
||||||
|
this.debug = debugLevel;
|
||||||
|
this.logs = logs;
|
||||||
|
}
|
||||||
|
|
||||||
|
cout (string, debugLevel) {
|
||||||
|
if (!debugLevel) debugLevel = 0;
|
||||||
var time = getTime();
|
var time = getTime();
|
||||||
string = `[${time.year}.${time.month}.${time.day}-${time.hours}:${time.minutes}:${time.seconds}] | ${String(string)}`
|
|
||||||
console.log(string);
|
if (this.debug >= debugLevel) {
|
||||||
|
console.log(`[${time.year}.${time.month}.${time.day}-${time.hours}:${time.minutes}:${time.seconds}] | ${String(string)}`);
|
||||||
|
if (this.logs) {
|
||||||
log(string);
|
log(string);
|
||||||
};
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = { cin, cout, createLog, log };
|
module.exports = { cin, cout, createLog, log };
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@thundernetworkrad/std",
|
"name": "@thundernetworkrad/std",
|
||||||
"version": "2022.12.29",
|
"version": "2023.01.24",
|
||||||
"description": "Standard module for javascript",
|
"description": "Standard module for javascript",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
Loading…
Reference in a new issue