diff --git a/index.js b/index.js index 5d52b5d..6d8a453 100644 --- a/index.js +++ b/index.js @@ -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 }; diff --git a/package.json b/package.json index 666f569..20dde5c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@thundernetworkrad/std", - "version": "2022.12.29", + "version": "2023.01.24", "description": "Standard module for javascript", "main": "index.js", "scripts": {