Variable ErrorLoggerConst ErrorLogger : { LEVELS : { ERROR : "error" ; WARN : "warn" ; INFO : "info" ; DEBUG : "debug" } ; error ( module : string , message : string , error ?: unknown ) : void ; warn ( module : string , message : string ) : void ; info ( module : string , message : string ) : void ; debug ( module : string , message : string ) : void ; quotaError ( module : string , available : number , needed : number ) : void ; networkError ( module : string , url : string , status : string | number , error ?: unknown , ) : void ; validationError ( module : string , field : string , expectedFormat : string , ) : void ; idbError ( module : string , operation : string , error ?: unknown ) : void ; performance ( module : string , operation : string , milliseconds : number ) : void ; memoryWarning ( module : string , usedMB : number ) : void ; operation ( module : string , operation : string ) : ErrorLoggerOperationContext ; } = ...
Type Declaration LEVELS : { ERROR : "error" ; WARN : "warn" ; INFO : "info" ; DEBUG : "debug" } error : functionerror ( module : string , message : string , error ?: unknown ) : void Parameters module : string message : string Optionalerror : unknown Returns void warn : functionwarn ( module : string , message : string ) : void Parameters module : string message : string Returns void info : functioninfo ( module : string , message : string ) : void Parameters module : string message : string Returns void debug : functiondebug ( module : string , message : string ) : void Parameters module : string message : string Returns void quotaError : functionquotaError ( module : string , available : number , needed : number ) : void Parameters module : string available : number needed : number Returns void networkError : functionnetworkError ( module : string , url : string , status : string | number , error ?: unknown , ) : void Parameters module : string url : string status : string | number Optionalerror : unknown Returns void validationError : functionvalidationError ( module : string , field : string , expectedFormat : string ) : void Parameters module : string field : string expectedFormat : string Returns void idbError : functionidbError ( module : string , operation : string , error ?: unknown ) : void Parameters module : string operation : string Optionalerror : unknown Returns void Parameters module : string operation : string milliseconds : number Returns void memoryWarning : functionmemoryWarning ( module : string , usedMB : number ) : void Parameters module : string usedMB : number Returns void operation : functionoperation ( module : string , operation : string ) : ErrorLoggerOperationContext Parameters module : string operation : string Returns ErrorLoggerOperationContext
Module-tagged error reporting, layered on top of Log.
Where
Logtakes a free-form message, every method here takes the emittingmoduleas its first argument and renders[module] message, so the origin is uniform across the codebase instead of being re-typed at each call site.Two behaviours worth knowing:
error()also prints thestackwhen the value carries one, and every method guards onLogbeing present — this module is reachable before boot and in consumers that tree-shook the logger, wheredebug()falls back to the console directly rather than recursing.