UNPKG

@rollercoaster-dev/rd-logger

Version:

A neurodivergent-friendly logger for Rollercoaster.dev projects

34 lines (33 loc) 1 kB
import chalk from 'chalk'; export const LOG_LEVEL_PRIORITY = { debug: 0, info: 1, warn: 2, error: 3, fatal: 4, }; // Define colors for each log level export const DEFAULT_LEVEL_COLORS = { debug: chalk.blue, info: chalk.green, warn: chalk.yellow, error: chalk.red, fatal: chalk.magenta, }; // Define icons for each log level export const DEFAULT_LEVEL_ICONS = { debug: '🔍', info: '🟢', warn: '🟡', error: '🔴', fatal: '💀', }; export const DEFAULT_LOGGER_CONFIG = { level: process.env.LOG_LEVEL || 'info', // Default level prettyPrint: process.env.NODE_ENV !== 'production', // Pretty print in dev, plain in prod colorize: true, // Only colorize if output is a TTY includeStackTrace: process.env.NODE_ENV !== 'production', // Show stack trace in dev logToFile: false, // Default to console logging logFilePath: './app.log', // Default log file path use24HourFormat: true, // Default to 24-hour format };