@datadog/browser-logs
Version:
Datadog browser logs library.
63 lines (62 loc) • 3.29 kB
TypeScript
import { Context, ContextValue, UserConfiguration } from '@datadog/browser-core';
import { HandlerType, Logger, LoggerConfiguration, StatusType } from './logger';
export interface LogsUserConfiguration extends UserConfiguration {
forwardErrorsToLogs?: boolean;
}
export declare type Status = keyof typeof StatusType;
declare const STUBBED_LOGS: {
logger: {
debug(message: string, context?: Context | undefined): void;
error(message: string, context?: Context | undefined): void;
info(message: string, context?: Context | undefined): void;
log(message: string, context?: Context | undefined, status?: "error" | "debug" | "info" | "warn" | undefined): void;
warn(message: string, context?: Context | undefined): void;
setContext(context: Context): void;
addContext(key: string, value: ContextValue): void;
setHandler(handler: HandlerType): void;
setLevel(level: StatusType): void;
};
init(userConfiguration: LogsUserConfiguration): void;
addLoggerGlobalContext(key: string, value: ContextValue): void;
setLoggerGlobalContext(context: Context): void;
createLogger(name: string, conf?: LoggerConfiguration | undefined): Logger;
getLogger(name: string): Logger | undefined;
};
export declare type LogsGlobal = typeof STUBBED_LOGS;
export declare const datadogLogs: {
logger: {
debug(message: string, context?: Context | undefined): void;
error(message: string, context?: Context | undefined): void;
info(message: string, context?: Context | undefined): void;
log(message: string, context?: Context | undefined, status?: "error" | "debug" | "info" | "warn" | undefined): void;
warn(message: string, context?: Context | undefined): void;
setContext(context: Context): void;
addContext(key: string, value: ContextValue): void;
setHandler(handler: HandlerType): void;
setLevel(level: StatusType): void;
};
init(userConfiguration: LogsUserConfiguration): void;
addLoggerGlobalContext(key: string, value: ContextValue): void;
setLoggerGlobalContext(context: Context): void;
createLogger(name: string, conf?: LoggerConfiguration | undefined): Logger;
getLogger(name: string): Logger | undefined;
};
export declare function makeLogsGlobal(stub: LogsGlobal): {
logger: {
debug(message: string, context?: Context | undefined): void;
error(message: string, context?: Context | undefined): void;
info(message: string, context?: Context | undefined): void;
log(message: string, context?: Context | undefined, status?: "error" | "debug" | "info" | "warn" | undefined): void;
warn(message: string, context?: Context | undefined): void;
setContext(context: Context): void;
addContext(key: string, value: ContextValue): void;
setHandler(handler: HandlerType): void;
setLevel(level: StatusType): void;
};
init(userConfiguration: LogsUserConfiguration): void;
addLoggerGlobalContext(key: string, value: ContextValue): void;
setLoggerGlobalContext(context: Context): void;
createLogger(name: string, conf?: LoggerConfiguration | undefined): Logger;
getLogger(name: string): Logger | undefined;
};
export {};