cross-log
Version:
A universal logging package that works in both browser and Node.js environments with environment variable configuration
75 lines • 2.07 kB
TypeScript
/**
* Browser-specific logger implementation
*/
import { BaseLogger } from './base';
import { LogLevel, LogEntry, PartialLoggerConfig } from '../core/types';
export declare class BrowserLogger extends BaseLogger {
private storageAvailable;
private originalConsole;
constructor(initialConfig?: PartialLoggerConfig);
/**
* 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: PartialLoggerConfig): 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;
}
/**
* Factory function to create a browser logger instance
*/
export declare function createLogger(config?: PartialLoggerConfig): BrowserLogger;
//# sourceMappingURL=browser.d.ts.map