mirror of
https://github.com/documenso/documenso.git
synced 2025-11-12 15:53:02 +10:00
database seed and coloredConsole
This commit is contained in:
40
packages/lib/coloredConsole.ts
Normal file
40
packages/lib/coloredConsole.ts
Normal 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();
|
||||
@ -1 +1 @@
|
||||
export {};
|
||||
export { coloredConsole } from "./coloredConsole";
|
||||
|
||||
Reference in New Issue
Block a user