forked from syntaxbullet/AuroraBot-discord
feat: add centralized logger utility
Add logger.ts with consistent emoji prefixes for all log levels: - info, success, warn, error, debug This provides a single source of truth for logging and enables future extensibility for file logging or external services.
This commit is contained in:
39
src/lib/logger.ts
Normal file
39
src/lib/logger.ts
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
/**
|
||||||
|
* Centralized logging utility with consistent formatting
|
||||||
|
*/
|
||||||
|
export const logger = {
|
||||||
|
/**
|
||||||
|
* General information message
|
||||||
|
*/
|
||||||
|
info: (message: string, ...args: any[]) => {
|
||||||
|
console.log(`ℹ️ ${message}`, ...args);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Success message
|
||||||
|
*/
|
||||||
|
success: (message: string, ...args: any[]) => {
|
||||||
|
console.log(`✅ ${message}`, ...args);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Warning message
|
||||||
|
*/
|
||||||
|
warn: (message: string, ...args: any[]) => {
|
||||||
|
console.warn(`⚠️ ${message}`, ...args);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Error message
|
||||||
|
*/
|
||||||
|
error: (message: string, ...args: any[]) => {
|
||||||
|
console.error(`❌ ${message}`, ...args);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Debug message
|
||||||
|
*/
|
||||||
|
debug: (message: string, ...args: any[]) => {
|
||||||
|
console.log(`🔍 ${message}`, ...args);
|
||||||
|
},
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user