adding option to add custom colors
This commit is contained in:
parent
3562efdd6f
commit
feae07bcb0
36
src/index.ts
36
src/index.ts
@ -57,6 +57,10 @@ export class Logging {
|
|||||||
Logging.message(LoggingTypes.Log, message);
|
Logging.message(LoggingTypes.Log, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static logWithCustomColors(type: LoggingTypes, colors: string, ...message: any[]) {
|
||||||
|
Logging.message(type, message, colors);
|
||||||
|
}
|
||||||
|
|
||||||
static error(error: Error | string) {
|
static error(error: Error | string) {
|
||||||
if (typeof error === "string") {
|
if (typeof error === "string") {
|
||||||
Logging.errorMessage(error);
|
Logging.errorMessage(error);
|
||||||
@ -74,21 +78,25 @@ export class Logging {
|
|||||||
Logging.message(LoggingTypes.Error, message);
|
Logging.message(LoggingTypes.Error, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async message(type: LoggingTypes, message: any[] | string) {
|
private static async message(type: LoggingTypes, message: any[] | string, customColors?: string) {
|
||||||
var consoleLogFormat = Reset;
|
var consoleLogFormat = Reset;
|
||||||
switch (type) {
|
if (!customColors) {
|
||||||
case LoggingTypes.Log:
|
switch (type) {
|
||||||
//m += FgWhite + BgBlack;
|
case LoggingTypes.Log:
|
||||||
break;
|
//m += FgWhite + BgBlack;
|
||||||
case LoggingTypes.Error:
|
break;
|
||||||
consoleLogFormat += FgRed;//FgWhite + BgRed + FgWhite;
|
case LoggingTypes.Error:
|
||||||
break;
|
consoleLogFormat += FgRed;//FgWhite + BgRed + FgWhite;
|
||||||
case LoggingTypes.Debug:
|
break;
|
||||||
consoleLogFormat += FgCyan;
|
case LoggingTypes.Debug:
|
||||||
break;
|
consoleLogFormat += FgCyan;
|
||||||
case LoggingTypes.Warning:
|
break;
|
||||||
consoleLogFormat += FgYellow;
|
case LoggingTypes.Warning:
|
||||||
break;
|
consoleLogFormat += FgYellow;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
consoleLogFormat += customColors;
|
||||||
}
|
}
|
||||||
var mb = "";
|
var mb = "";
|
||||||
if (typeof message === "string") {
|
if (typeof message === "string") {
|
||||||
|
Loading…
Reference in New Issue
Block a user