murmuraba
Version:
Real-time audio noise reduction with advanced chunked processing for web applications
168 lines • 6.36 kB
TypeScript
/**
* Centralized Logging Utility
* Replaces scattered console.log statements with structured logging
*/
export declare enum LogLevel {
DEBUG = 0,
INFO = 1,
WARN = 2,
ERROR = 3,
SILENT = 4
}
export declare enum LogCategory {
AUDIO = "AUDIO",
RECORDING = "RECORDING",
PROCESSING = "PROCESSING",
WASM = "WASM",
UI = "UI",
API = "API",
PERFORMANCE = "PERFORMANCE",
SYSTEM = "SYSTEM",
TEST = "TEST"
}
export interface LogEntry {
timestamp: number;
level: LogLevel;
category: LogCategory;
message: string;
data?: any;
source?: string;
context?: Record<string, any>;
}
export interface LoggerConfig {
level: LogLevel;
enableConsole: boolean;
enableStorage: boolean;
maxStoredEntries: number;
enableTimestamps: boolean;
enableColors: boolean;
categories: LogCategory[];
}
declare class Logger {
private config;
private entries;
private listeners;
constructor(config?: Partial<LoggerConfig>);
private log;
debug(category: LogCategory, message: string, data?: any, context?: Record<string, any>): void;
info(category: LogCategory, message: string, data?: any, context?: Record<string, any>): void;
warn(category: LogCategory, message: string, data?: any, context?: Record<string, any>): void;
error(category: LogCategory, message: string, data?: any, context?: Record<string, any>): void;
time(category: LogCategory, label: string, context?: Record<string, any>): {
end: () => number;
};
group(category: LogCategory, title: string, context?: Record<string, any>): {
log: (message: string, data?: any) => void;
end: () => void;
};
private outputToConsole;
private getConsoleMethod;
private colorizeMessage;
private getCallerInfo;
setLevel(level: LogLevel): void;
setCategories(categories: LogCategory[]): void;
enableCategory(category: LogCategory): void;
disableCategory(category: LogCategory): void;
addListener(listener: (entry: LogEntry) => void): () => void;
removeListener(listener: (entry: LogEntry) => void): void;
exportLogs(): LogEntry[];
clearLogs(): void;
searchLogs(query: {
level?: LogLevel;
category?: LogCategory;
message?: string;
since?: number;
until?: number;
}): LogEntry[];
getStats(): {
total: number;
byLevel: Record<LogLevel, number>;
byCategory: Record<LogCategory, number>;
timeRange: {
oldest: number;
newest: number;
};
};
}
declare const logger: Logger;
export declare const AudioLogger: {
debug: (message: string, data?: any, context?: Record<string, any>) => void;
info: (message: string, data?: any, context?: Record<string, any>) => void;
warn: (message: string, data?: any, context?: Record<string, any>) => void;
error: (message: string, data?: any, context?: Record<string, any>) => void;
time: (label: string, context?: Record<string, any>) => {
end: () => number;
};
group: (title: string, context?: Record<string, any>) => {
log: (message: string, data?: any) => void;
end: () => void;
};
};
export declare const RecordingLogger: {
debug: (message: string, data?: any, context?: Record<string, any>) => void;
info: (message: string, data?: any, context?: Record<string, any>) => void;
warn: (message: string, data?: any, context?: Record<string, any>) => void;
error: (message: string, data?: any, context?: Record<string, any>) => void;
time: (label: string, context?: Record<string, any>) => {
end: () => number;
};
group: (title: string, context?: Record<string, any>) => {
log: (message: string, data?: any) => void;
end: () => void;
};
};
export declare const ProcessingLogger: {
debug: (message: string, data?: any, context?: Record<string, any>) => void;
info: (message: string, data?: any, context?: Record<string, any>) => void;
warn: (message: string, data?: any, context?: Record<string, any>) => void;
error: (message: string, data?: any, context?: Record<string, any>) => void;
time: (label: string, context?: Record<string, any>) => {
end: () => number;
};
group: (title: string, context?: Record<string, any>) => {
log: (message: string, data?: any) => void;
end: () => void;
};
};
export declare const WASMLogger: {
debug: (message: string, data?: any, context?: Record<string, any>) => void;
info: (message: string, data?: any, context?: Record<string, any>) => void;
warn: (message: string, data?: any, context?: Record<string, any>) => void;
error: (message: string, data?: any, context?: Record<string, any>) => void;
time: (label: string, context?: Record<string, any>) => {
end: () => number;
};
group: (title: string, context?: Record<string, any>) => {
log: (message: string, data?: any) => void;
end: () => void;
};
};
export declare const UILogger: {
debug: (message: string, data?: any, context?: Record<string, any>) => void;
info: (message: string, data?: any, context?: Record<string, any>) => void;
warn: (message: string, data?: any, context?: Record<string, any>) => void;
error: (message: string, data?: any, context?: Record<string, any>) => void;
time: (label: string, context?: Record<string, any>) => {
end: () => number;
};
group: (title: string, context?: Record<string, any>) => {
log: (message: string, data?: any) => void;
end: () => void;
};
};
export declare const PerformanceLogger: {
debug: (message: string, data?: any, context?: Record<string, any>) => void;
info: (message: string, data?: any, context?: Record<string, any>) => void;
warn: (message: string, data?: any, context?: Record<string, any>) => void;
error: (message: string, data?: any, context?: Record<string, any>) => void;
time: (label: string, context?: Record<string, any>) => {
end: () => number;
};
group: (title: string, context?: Record<string, any>) => {
log: (message: string, data?: any) => void;
end: () => void;
};
};
export { logger as Logger };
export default logger;
//# sourceMappingURL=logger.d.ts.map