UNPKG

@roochnetwork/rooch-sdk

Version:
63 lines (62 loc) 1.79 kB
/** * LogLevel enum representing different logging severity levels */ export declare enum LogLevel { INFO = "info", WARN = "warn", ERROR = "error", DEBUG = "debug" } /** * Logger interface defining the standard logging methods */ export interface Logger { info(message: string, ...args: any[]): void; warn(message: string, ...args: any[]): void; error(message: string, ...args: any[]): void; debug(message: string, ...args: any[]): void; } /** * Format an error object for consistent logging */ export declare function formatError(error: any): string; /** * Standard logger implementation using debug package */ export declare class RoochLogger implements Logger { private infoLogger; private warnLogger; private errorLogger; private debugLogger; /** * Create a new logger instance for a specific module * * @param moduleName Name of the module (e.g., 'transport', 'client') * @param subModule Optional sub-module name (e.g., 'ws', 'http') */ constructor(moduleName: string, subModule?: string); /** * Log an informational message */ info(message: string, ...args: any[]): void; /** * Log a warning message */ warn(message: string, ...args: any[]): void; /** * Log an error message */ error(message: string, ...args: any[]): void; /** * Log a debug message (more verbose than info) */ debug(message: string, ...args: any[]): void; } /** * Create a new logger instance * * @param moduleName Name of the module (e.g., 'transport', 'client') * @param subModule Optional sub-module name (e.g., 'ws', 'http') * @returns A Logger instance */ export declare function createLogger(moduleName: string, subModule?: string): Logger;