1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-14 15:23:33 +00:00
Files
browser/libs/logging/src/log.service.ts
Oscar Hinton 67d3035aa5 [PM-22544] Add Performance measurement tools (#15475)
Adds logService.mark and logService.measure which are wrappers around performance.mark and performance.measure with extra debug logging for more visibility outside the performance tool.
2025-07-17 15:03:57 +02:00

34 lines
1.3 KiB
TypeScript

import { LogLevel } from "./log-level";
export abstract class LogService {
abstract debug(message?: any, ...optionalParams: any[]): void;
abstract info(message?: any, ...optionalParams: any[]): void;
abstract warning(message?: any, ...optionalParams: any[]): void;
abstract error(message?: any, ...optionalParams: any[]): void;
abstract write(level: LogLevel, message?: any, ...optionalParams: any[]): void;
/**
* Helper wrapper around `performance.measure` to log a measurement. Should also debug-log the data.
*
* @param start Start time of the measurement.
* @param trackGroup A track-group for the measurement, should generally be the team owning the domain.
* @param track A track for the measurement, should generally be the class name.
* @param measureName A descriptive name for the measurement.
* @param properties Additional properties to include.
*/
abstract measure(
start: DOMHighResTimeStamp,
trackGroup: string,
track: string,
measureName: string,
properties?: [string, any][],
): PerformanceMeasure;
/**
* Helper wrapper around `performance.mark` to log a mark. Should also debug-log the data.
*
* @param name Name of the mark to create.
*/
abstract mark(name: string): PerformanceMark;
}