Switch to Node.JS stack

This commit is contained in:
Lucàs
2022-12-21 15:32:27 +01:00
parent 64ac979669
commit 6b87f411c6
17 changed files with 254 additions and 210 deletions
+32
View File
@@ -0,0 +1,32 @@
class Log {
colors = {
red: '\x1b[31m',
green: '\x1b[32m',
yellow: '\x1b[33m',
};
private readonly logFunction: (message?: any, ...optionalParams: any[]) => void;
constructor(logFunction: (message?: any, ...optionalParams: any[]) => void) {
this.logFunction = logFunction;
}
info(message: string): void {
this.logFunction(message);
}
success(message: string): void {
this.logFunction(this.colors.green, message);
}
error(message: string): void {
this.logFunction(this.colors.red, message);
}
warning(message: string): void {
this.logFunction(this.colors.yellow, message);
}
}
const log = new Log(console.log);
export default log;