@xynehq/jaf
Version:
Juspay Agent Framework - A purely functional agent framework with immutable state and composable tools
63 lines • 1.77 kB
TypeScript
/**
* JAF Logging System
*
* Provides structured logging with different levels and output targets
*/
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;
//# sourceMappingURL=logger.d.ts.map