create-guilded-bot/packages/cli/utils/logger.ts

31 lines
803 B
TypeScript
Raw Normal View History

2022-11-22 09:43:25 +00:00
import * as kleur from "kleur";
2022-11-22 09:43:25 +00:00
const progressStyle = kleur.bold().gray;
const successStyle = kleur.bold().green;
const errorStyle = kleur.black().bold().red;
const warningStyle = kleur.black().bold().yellow;
export function warn(log: string) {
2022-11-22 09:43:25 +00:00
console.log(warningStyle(`warning`), " ", log);
}
export function error(log: string) {
2022-11-22 09:43:25 +00:00
console.log(errorStyle(`error`), " ", log);
}
export function info(log: string) {
2022-11-22 09:43:25 +00:00
console.log(successStyle(`info`), " ", log);
}
export function success(log: string) {
2022-11-22 09:43:25 +00:00
console.log(successStyle(`success`), " ", log);
}
export function custom(customType: string, log: string) {
2022-11-22 09:43:25 +00:00
console.log(progressStyle(`[${customType}] `), log);
}
export function customError(customType: string, log: string) {
2022-11-22 09:43:25 +00:00
console.log(errorStyle(`[${customType}] error `), log);
}