Class Logger<COMPONENT_NAMES> Constructors constructor new Logger< COMPONENT_NAMES > ( numberOfEntriesToRetain?: number ) : Logger < COMPONENT_NAMES > new Logger< COMPONENT_NAMES > ( initialEntries?: LogEntry < COMPONENT_NAMES > [] ) : Logger < COMPONENT_NAMES > new Logger< COMPONENT_NAMES > ( numberOfEntriesToRetain?: number , initialEntries?: LogEntry < COMPONENT_NAMES > [] ) : Logger < COMPONENT_NAMES > Type parameters Parameters Optional numberOfEntriesToRetain: number Returns Logger < COMPONENT_NAMES > Type parameters Parameters Optional initialEntries: LogEntry < COMPONENT_NAMES > [] Returns Logger < COMPONENT_NAMES > Type parameters Parameters Optional numberOfEntriesToRetain: number Optional initialEntries: LogEntry < COMPONENT_NAMES > [] Returns Logger < COMPONENT_NAMES > Properties Readonly entriesentries
: BehaviorSubject < LogEntry < COMPONENT_NAMES > [] > = ... Methods debug debug( component: COMPONENT_NAMES , message: string , traceObjectOrError?: any , error?: Error ) : void Parameters component: COMPONENT_NAMES message: string Optional traceObjectOrError: any Optional error: Error Returns void error error( component: COMPONENT_NAMES , message: string , traceObjectOrError?: any , error?: Error ) : void Parameters component: COMPONENT_NAMES message: string Optional traceObjectOrError: any Optional error: Error Returns void info info( component: COMPONENT_NAMES , message: string , traceObjectOrError?: any , error?: Error ) : void Parameters component: COMPONENT_NAMES message: string Optional traceObjectOrError: any Optional error: Error Returns void log log( level: "DEBUG" | "INFO" | "WARN" | "ERROR" , component: COMPONENT_NAMES , message: string , traceObjectOrError?: any , error?: Error ) : void Parameters level: "DEBUG" | "INFO" | "WARN" | "ERROR" component: COMPONENT_NAMES message: string Optional traceObjectOrError: any Optional error: Error Returns void warn warn( component: COMPONENT_NAMES , message: string , traceObjectOrError?: any , error?: Error ) : void Parameters component: COMPONENT_NAMES message: string Optional traceObjectOrError: any Optional error: Error Returns void Legend Class Class with type parameter Property Method Interface with type parameter Settings Theme OS Light Dark
This will be moved to Bragi once it settles, since it concerns protocol formats/giving shape to messages.
The generic type
COMPONENT_NAMES
can be used to restrict the possible component names. At heart, it is just a string (and it's fully valid to create aLogger<string>
), but to enforce consistency, you can implement it as a union type of specific strings, e.g.Logger<'network' | 'login' | 'unknown'>
.