/** * Log formatting utilities. * This file contains all log message formatting logic. */ import type { LogLevel } from '../../../shared/types/common.types.js'; import type { LogContext } from './log-context.js'; /** * Caller information extracted from stack trace. */ export interface CallerInfo { fileName: string; lineNumber: number; columnNumber: number; } /** * Get caller information from stack trace. * Extracts the file name, line number, and column number from the call stack. * This method traverses the stack to find the first project source file (in src/), * skipping external dependencies and Node.js internals. * * In tsx (development) mode: Parses default stack string for accurate .ts line numbers * In production mode: Shows .ts file names but without line numbers (inaccurate) * * @param skipFrames - Number of stack frames to skip before starting the search (default: 3 to skip logger internal frames) * @returns CallerInfo with fileName, lineNumber, columnNumber or null if cannot be determined */ export declare function getCallerInfo(skipFrames?: number): CallerInfo | null; /** * Format caller information for display. * * @param callerInfo - Caller info to format * @returns Formatted string like "file.ts:123" or just "file.ts" in production */ export declare function formatCallerInfo(callerInfo: CallerInfo): string; /** * Format a timestamp for logging. * @param date - The date to format * @returns Formatted timestamp string */ export declare function formatTimestamp(date: Date): string; /** * Format a log level for display. * @param level - The log level * @returns Formatted log level string */ export declare function formatLogLevel(level: LogLevel): string; /** * Format a PID for display. * @param pid - The process ID * @returns Formatted PID string */ export declare function formatPid(pid: number): string; /** * Create a colored log message for console output. * @param level - The log level * @param message - The log message * @param context - Optional log context * @returns Colored log message string */ export declare function createColoredLogMessage(level: LogLevel, message: string, context?: LogContext): string; /** * Create a plain text log message for file output. * @param level - The log level * @param message - The log message * @param context - Optional log context * @returns Plain text log message string */ export declare function createLogMessage(level: LogLevel, message: string, context?: LogContext): string; /** * Format an error object for logging. * @param error - The error to format * @returns Formatted error string */ export declare function formatError(error: unknown): string; //# sourceMappingURL=log-formatter.d.ts.map