flipper-common
Version:
Server & UI shared Flipper utilities
54 lines • 1.87 kB
TypeScript
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
export type LoggerTypes = 'error' | 'warn' | 'info' | 'debug';
export type LoggerTrackType = 'duration' | 'usage' | 'performance' | 'success-rate' | 'operation-cancelled';
export type LoggerArgs = {
isTest?: boolean;
};
export type LoggerInfo = {
formatted: Array<any>;
namespace: string;
type: LoggerTypes;
msg: any;
time: number;
};
export type LoggerPerformanceEntry = {
startTime: number;
name: string;
entryType: string;
duration: number;
};
export interface Logger {
track(type: LoggerTrackType, event: string, data?: any, plugin?: string): void;
trackTimeSince(mark: string, eventName?: string | null | undefined, data?: any): void;
info(...args: any[]): void;
warn(...args: any[]): void;
error(...args: any[]): void;
debug(...args: any[]): void;
}
export declare function getLogger(): Logger;
export declare function setLoggerInstance(logger: Logger): void;
/**
* A logger that doesn't log anything, used in tests and public Flipper builds
*/
export declare class NoopLogger implements Logger {
constructor();
track(_type: LoggerTrackType, _event: string, _data?: any, _plugin?: string): void;
trackTimeSince(_mark: string, _eventName?: string): void;
info(_data: any, _category: string): void;
warn(_data: any, _category: string): void;
error(_data: any, _category: string): void;
debug(_data: any, _category: string): void;
}
export declare function LoggerExtractError(...data: Array<any>): {
message: string;
error: Error;
};
export declare function LoggerFormat(type: LoggerTypes, ...data: Array<any>): LoggerInfo;
//# sourceMappingURL=Logger.d.ts.map