cross-log
Version:
A universal logging package that works in both browser and Node.js environments with environment variable configuration
71 lines • 1.92 kB
TypeScript
/**
* Browser-specific logger implementation
*/
import { BaseLogger } from './base';
import { LoggerConfig, LogLevel, LogEntry } from '../core/types';
export declare class BrowserLogger extends BaseLogger {
private storageAvailable;
private originalConsole;
constructor(initialConfig?: Partial<LoggerConfig>);
/**
* Output log with browser-specific styling
*/
protected outputLog(level: LogLevel, formattedMessage: string, _logEntry: LogEntry, ...args: unknown[]): void;
/**
* Output stack trace for errors
*/
protected outputStackTrace(error: Error): void;
/**
* Override configure to save to storage
*/
configure(newConfig: Partial<LoggerConfig>): void;
/**
* Override setLevel to save to storage
*/
setLevel(level: LogLevel): void;
/**
* Override enableCategory to save to storage
*/
enableCategory(category: string, minLevel?: LogLevel): void;
/**
* Override disableCategory to save to storage
*/
disableCategory(category: string): void;
/**
* Override enableAll to save to storage
*/
enableAll(): void;
/**
* Override disableAll to save to storage
*/
disableAll(): void;
/**
* Get original console method to avoid infinite recursion
*/
private getOriginalConsoleMethod;
/**
* Get color for log level
*/
private getColorForLevel;
/**
* Check if localStorage is available
*/
private checkStorageAvailability;
/**
* Load configuration from localStorage
*/
private loadConfigFromStorage;
/**
* Save configuration to localStorage
*/
private saveConfigToStorage;
/**
* Setup browser console controls
*/
private setupBrowserControls;
/**
* Capitalize first letter of string
*/
private capitalizeFirst;
}
//# sourceMappingURL=browser.d.ts.map