plazbot-cli
Version:
CLI para Plazbot SDK
41 lines (39 loc) • 1.24 kB
text/typescript
import chalk from 'chalk';
export const logger = {
info: (message: string) => {
console.log(chalk.white(message));
},
success: (message: string) => {
console.log(chalk.hex('#66BB6A')(`\n ✔ ${message}`));
},
warning: (message: string) => {
console.log(chalk.hex('#FFA726')(`\n ⚠ ${message}`));
},
error: (error: Error | string) => {
const message = error instanceof Error ? error.message : error;
console.error(chalk.hex('#EF5350')(`\n ✖ Error: ${message}`));
},
divider: (length: number = 50) => {
console.log(chalk.gray('─'.repeat(length)));
},
doubleDivider: (length: number = 50) => {
console.log(chalk.gray('═'.repeat(length)));
},
label: (key: string, value: string) => {
console.log(` ${chalk.gray(key + ':')} ${chalk.white(value)}`);
},
title: (text: string) => {
console.log(chalk.bold.hex('#4CAF50')(`\n ${text}`));
console.log(chalk.gray(' ' + '─'.repeat(40)));
},
dim: (message: string) => {
console.log(chalk.gray(` ${message}`));
},
json: (data: any) => {
const formatted = JSON.stringify(data, null, 2)
.split('\n')
.map(line => ' ' + line)
.join('\n');
console.log(chalk.gray(formatted));
}
};