database seed and coloredConsole

This commit is contained in:
Timur Ercan
2023-01-11 11:44:35 +01:00
parent 5003e32e77
commit c024b03acc
7 changed files with 419 additions and 4203 deletions

View File

@ -0,0 +1,40 @@
// https://stackoverflow.com/questions/9781218/how-to-change-node-jss-console-font-color
export default class coloredConsole {
public static setupColoredConsole(): void {
let infoLog = console.info;
let logLog = console.log;
let errorLog = console.error;
let warnLog = console.warn;
let colors = {
Reset: "\x1b[0m",
Red: "\x1b[31m",
Green: "\x1b[32m",
Yellow: "\x1b[33m",
};
console.info = function (args: any) {
let copyArgs = Array.prototype.slice.call(arguments);
copyArgs.unshift(colors.Green);
copyArgs.push(colors.Reset);
infoLog.apply(null, copyArgs);
};
console.warn = function (args: any) {
let copyArgs = Array.prototype.slice.call(arguments);
copyArgs.unshift(colors.Yellow);
copyArgs.push(colors.Reset);
warnLog.apply(null, copyArgs);
};
console.error = function (args: any) {
let copyArgs = Array.prototype.slice.call(arguments);
copyArgs.unshift(colors.Red);
copyArgs.push(colors.Reset);
errorLog.apply(null, copyArgs);
};
}
}
coloredConsole.setupColoredConsole();

View File

@ -1 +1 @@
export {};
export { coloredConsole } from "./coloredConsole";