UNPKG

@xynehq/jaf

Version:

Juspay Agent Framework - A purely functional agent framework with immutable state and composable tools

94 lines 2.62 kB
/** * JAF Logging System * * Provides structured logging with different levels and output targets * Automatically sanitizes sensitive data before logging */ export declare enum LogLevel { DEBUG = 0, INFO = 1, WARN = 2, ERROR = 3, FATAL = 4, SILENT = 5 } export interface LogEntry { level: LogLevel; message: string; timestamp: Date; context?: string; metadata?: Record<string, unknown>; error?: Error; } export interface LoggerConfig { level?: LogLevel; context?: string; output?: LogOutput; format?: LogFormat; } export type LogOutput = 'console' | 'silent' | 'custom'; export type LogFormat = 'json' | 'text' | 'pretty'; export interface Logger { debug: (message: string, metadata?: Record<string, unknown>) => void; info: (message: string, metadata?: Record<string, unknown>) => void; warn: (message: string, metadata?: Record<string, unknown>) => void; error: (message: string, error?: Error | unknown, metadata?: Record<string, unknown>) => void; fatal: (message: string, error?: Error | unknown, metadata?: Record<string, unknown>) => void; child: (context: string) => Logger; setLevel: (level: LogLevel) => void; } /** * Create a logger instance */ export declare const createLogger: (config?: LoggerConfig) => Logger; /** * Default logger instance */ export declare const logger: Logger; /** * Configure global logger settings */ export declare const configureLogger: (config: { level?: LogLevel; output?: LogOutput; format?: LogFormat; }) => void; /** * Create a context-specific logger */ export declare const getLogger: (context: string) => Logger; /** * Utility to safely stringify errors */ export declare const stringifyError: (error: unknown) => string; /** * Re-export sanitizeObject for use in custom logging */ export { sanitizeObject } from '../core/tracing.js'; /** * Safe console logging with automatic sanitization * Use these instead of direct console.log/warn/error calls */ export declare const safeConsole: { /** * Log a message with sanitized data */ log: (message: string, ...data: any[]) => void; /** * Warn with sanitized data */ warn: (message: string, ...data: any[]) => void; /** * Error with sanitized data */ error: (message: string, ...data: any[]) => void; /** * Info with sanitized data */ info: (message: string, ...data: any[]) => void; /** * Debug with sanitized data */ debug: (message: string, ...data: any[]) => void; }; //# sourceMappingURL=logger.d.ts.map