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) {
var time = getTime();
string = `[${time.year}.${time.month}.${time.day}-${time.hours}:${time.minutes}:${time.seconds}] | ${String(string)}`
console.log(string);
log(string);
};
class createCout {
constructor (debugLevel, logs) {
this.debug = debugLevel;
this.logs = logs;
}
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 };

View file

@ -1,6 +1,6 @@
{
"name": "@thundernetworkrad/std",
"version": "2022.12.29",
"version": "2023.01.24",
"description": "Standard module for javascript",
"main": "index.js",
"scripts": {