UNPKG

3.41 kBTypeScriptView Raw
1import { Context, ContextValue, UserConfiguration } from '@datadog/browser-core';
2import { HandlerType, Logger, LoggerConfiguration, StatusType } from './logger';
3export interface LogsUserConfiguration extends UserConfiguration {
4 forwardErrorsToLogs?: boolean;
5}
6export declare type Status = keyof typeof StatusType;
7declare const STUBBED_LOGS: {
8 logger: {
9 debug(message: string, context?: Context | undefined): void;
10 error(message: string, context?: Context | undefined): void;
11 info(message: string, context?: Context | undefined): void;
12 log(message: string, context?: Context | undefined, status?: "error" | "debug" | "info" | "warn" | undefined): void;
13 warn(message: string, context?: Context | undefined): void;
14 setContext(context: Context): void;
15 addContext(key: string, value: ContextValue): void;
16 removeContext(key: string): void;
17 setHandler(handler: HandlerType): void;
18 setLevel(level: StatusType): void;
19 };
20 init(userConfiguration: LogsUserConfiguration): void;
21 addLoggerGlobalContext(key: string, value: ContextValue): void;
22 setLoggerGlobalContext(context: Context): void;
23 createLogger(name: string, conf?: LoggerConfiguration | undefined): Logger;
24 getLogger(name: string): Logger | undefined;
25};
26export declare type LogsGlobal = typeof STUBBED_LOGS;
27export declare const datadogLogs: {
28 logger: {
29 debug(message: string, context?: Context | undefined): void;
30 error(message: string, context?: Context | undefined): void;
31 info(message: string, context?: Context | undefined): void;
32 log(message: string, context?: Context | undefined, status?: "error" | "debug" | "info" | "warn" | undefined): void;
33 warn(message: string, context?: Context | undefined): void;
34 setContext(context: Context): void;
35 addContext(key: string, value: ContextValue): void;
36 removeContext(key: string): void;
37 setHandler(handler: HandlerType): void;
38 setLevel(level: StatusType): void;
39 };
40 init(userConfiguration: LogsUserConfiguration): void;
41 addLoggerGlobalContext(key: string, value: ContextValue): void;
42 setLoggerGlobalContext(context: Context): void;
43 createLogger(name: string, conf?: LoggerConfiguration | undefined): Logger;
44 getLogger(name: string): Logger | undefined;
45};
46export declare function makeLogsGlobal(stub: LogsGlobal): {
47 logger: {
48 debug(message: string, context?: Context | undefined): void;
49 error(message: string, context?: Context | undefined): void;
50 info(message: string, context?: Context | undefined): void;
51 log(message: string, context?: Context | undefined, status?: "error" | "debug" | "info" | "warn" | undefined): void;
52 warn(message: string, context?: Context | undefined): void;
53 setContext(context: Context): void;
54 addContext(key: string, value: ContextValue): void;
55 removeContext(key: string): void;
56 setHandler(handler: HandlerType): void;
57 setLevel(level: StatusType): void;
58 };
59 init(userConfiguration: LogsUserConfiguration): void;
60 addLoggerGlobalContext(key: string, value: ContextValue): void;
61 setLoggerGlobalContext(context: Context): void;
62 createLogger(name: string, conf?: LoggerConfiguration | undefined): Logger;
63 getLogger(name: string): Logger | undefined;
64};
65export {};