UNPKG

@wgtechlabs/log-engine

Version:

A lightweight, security-first logging utility with automatic data redaction for Node.js applications - the first logging library with built-in PII protection.

47 lines 2.21 kB
/** * Core message formatting functionality * Handles the main log message formatting with colors, timestamps, and levels */ import { LogLevel, LogData, LogFormatConfig } from '../types'; /** * Core message formatter class * Provides the main formatting functionality for log messages */ export declare class MessageFormatter { /** * Default format configuration to avoid object recreation on every call */ private static readonly DEFAULT_FORMAT_CONFIG; /** * Formats a log message with timestamp, level indicator, and appropriate coloring * Creates a structured log entry: [ISO_TIMESTAMP][LOCAL_TIME][LEVEL]: message [data] * @param level - The log level to format for * @param message - The message content to format * @param data - Optional data object to include in the log output * @param formatConfig - Optional format configuration to control element inclusion * @returns Formatted string with ANSI colors and timestamps */ static format(level: LogLevel, message: string, data?: LogData, formatConfig?: LogFormatConfig): string; /** * Formats a Log Engine system message with [LOG ENGINE] prefix instead of log levels * Used for internal messages like deprecation warnings that should be distinguished from user logs * @param message - The system message content to format * @param formatConfig - Optional format configuration to control element inclusion * @returns Formatted string with ANSI colors, timestamps, and LOG ENGINE prefix */ static formatSystemMessage(message: string, formatConfig?: LogFormatConfig): string; /** * Converts LogLevel enum to human-readable string * @param level - The LogLevel to convert * @returns String representation of the log level */ private static getLevelName; /** * Maps LogLevel to appropriate ANSI color code * Colors help quickly identify message severity in console output * @param level - The LogLevel to get color for * @returns ANSI color escape sequence */ private static getLevelColor; } //# sourceMappingURL=message-formatter.d.ts.map