Add debug Level in cout

This commit is contained in:
Killer Boss Original 2023-01-24 17:04:50 +01:00 committed by GitHub
parent 617a166bfb
commit 0a2cb47b06
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 7 deletions

View file

@ -45,11 +45,24 @@ function cin (question, hide) {
}) })
}; };
async function cout (string) { class createCout {
var time = getTime(); constructor (debugLevel, logs) {
string = `[${time.year}.${time.month}.${time.day}-${time.hours}:${time.minutes}:${time.seconds}] | ${String(string)}` this.debug = debugLevel;
console.log(string); this.logs = logs;
log(string); }
};
cout (string, debugLevel) {
if (!debugLevel) debugLevel = 0;
var time = getTime();
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);
}
}
return;
};
}
module.exports = { cin, cout, createLog, log }; module.exports = { cin, cout, createLog, log };

View file

@ -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": {