@continue-reasoning/mini-agent
Version:
A platform-agnostic AI agent framework for building autonomous AI agents with tool execution capabilities
118 lines • 3.46 kB
TypeScript
/**
* @fileoverview Logger System Implementation
*
* This module provides a comprehensive logging system with automatic class/method detection,
* multiple log levels, and flexible configuration options.
*/
export declare enum LogLevel {
NONE = 0,
ERROR = 1,
WARN = 2,
INFO = 3,
DEBUG = 4
}
export interface ILoggerConfig {
/** Global log level */
level: LogLevel;
/** Enable automatic class/method detection */
autoDetectContext: boolean;
/** Custom log formatter */
formatter?: (level: LogLevel, message: string, context?: string, timestamp?: Date) => string;
/** Custom log output handler */
outputHandler?: (formattedMessage: string, level: LogLevel) => void;
/** Enable timestamps */
includeTimestamp: boolean;
/** Enable colors in console output */
enableColors: boolean;
}
export interface ILogger {
debug(message: string, context?: string): void;
info(message: string, context?: string): void;
warn(message: string, context?: string): void;
error(message: string, context?: string): void;
log(level: LogLevel, message: string, context?: string): void;
setLevel(level: LogLevel): void;
getLevel(): LogLevel;
createChildLogger(context: string): ILogger;
}
/**
* Logger implementation with automatic context detection
*/
export declare class Logger implements ILogger {
private config;
private context;
constructor(config?: Partial<ILoggerConfig>, context?: string);
/**
* Debug level logging
*/
debug(message: string, context?: string): void;
/**
* Info level logging
*/
info(message: string, context?: string): void;
/**
* Warning level logging
*/
warn(message: string, context?: string): void;
/**
* Error level logging
*/
error(message: string, context?: string): void;
/**
* Generic log method with level specification
*/
log(level: LogLevel, message: string, context?: string): void;
/**
* Set the log level
*/
setLevel(level: LogLevel): void;
/**
* Get the current log level
*/
getLevel(): LogLevel;
/**
* Create a child logger with a specific context
*/
createChildLogger(context: string): ILogger;
/**
* Detect the calling context automatically using stack trace
*/
private detectContext;
/**
* Default message formatter
*/
private defaultFormatter;
/**
* Default output handler
*/
private defaultOutputHandler;
/**
* Get string representation of log level
*/
private getLevelString;
/**
* Colorize log level based on severity
*/
private colorizeLevel;
}
/**
* Get the global logger instance
*/
export declare function getLogger(): ILogger;
/**
* Set the global logger instance
*/
export declare function setLogger(logger: ILogger): void;
/**
* Configure the global logger
*/
export declare function configureLogger(config: Partial<ILoggerConfig>): void;
/**
* Create a logger with specific context
*/
export declare function createLogger(context: string, config?: Partial<ILoggerConfig>): ILogger;
/**
* Utility function to create a method logger decorator
*/
export declare function logMethod(level?: LogLevel): (target: any, propertyKey: string, descriptor?: PropertyDescriptor) => PropertyDescriptor | ((value: any, context: any) => any);
//# sourceMappingURL=logger.d.ts.map