Comparing version 0.3.2 to 0.3.3
{ | ||
"name": "debux", | ||
"version": "0.3.2", | ||
"version": "0.3.3", | ||
"description": "Easy-to-use library for debugging your code", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
@@ -48,3 +48,3 @@ import chalk from "chalk"; | ||
public log(s: string | null, options?: Options): void { | ||
this.addCache(s ?? "null"); | ||
this.addCache(this.constructEntry(s, "log", options)); | ||
if (this.logLevel == level.all) | ||
@@ -55,3 +55,3 @@ return Debux.consoleLog(this.constructMessage(s, "log", options)); | ||
public error(s: string, options?: Options): void { | ||
this.addCache(s); | ||
this.addCache(this.constructEntry(s, "error", options)); | ||
if (this.logLevel >= level.error) | ||
@@ -62,3 +62,3 @@ return Debux.consoleLog(this.constructMessage(chalk.red(s), "error", options)); | ||
public warn(s: string, options?: Options): void { | ||
this.addCache(s); | ||
this.addCache(this.constructEntry(s, "warn", options)); | ||
if (this.logLevel >= level.warning) | ||
@@ -69,3 +69,3 @@ return Debux.consoleLog(this.constructMessage(chalk.yellow(s), "warn", options)); | ||
public info(s: string, options?: Options): void { | ||
this.addCache(s); | ||
this.addCache(this.constructEntry(s, "info", options)); | ||
if (this.logLevel >= level.info) | ||
@@ -94,2 +94,13 @@ return Debux.consoleLog(this.constructMessage(s, "info", options)); | ||
private constructEntry(s: string | null, cmd: cmd, options?: Options): string { | ||
let msg: string = | ||
new Date().toUTCString() + seperator + this.getCMDString(cmd); | ||
if (typeof options?.process == "string") msg += options.process + seperator; | ||
if (typeof options?.class == "string") msg += options.class + seperator; | ||
if (typeof options?.event == "string") msg += options.event + seperator; | ||
if (typeof options?.function == "string") msg += options.function + seperator; | ||
if (!s) return msg.slice(0, msg.length - 3); | ||
else return msg + s; | ||
} | ||
private getCMDString(cmd: cmd): string { | ||
@@ -96,0 +107,0 @@ switch (cmd) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12570
275