UNPKG

1.56 kBTypeScriptView Raw
1import { Context, ContextValue, UserConfiguration } from '@datadog/browser-core';
2import { HandlerType, Logger, StatusType } from './logger';
3import { startLogs } from './logs';
4export interface LogsUserConfiguration extends UserConfiguration {
5 forwardErrorsToLogs?: boolean;
6}
7export interface LoggerConfiguration {
8 level?: StatusType;
9 handler?: HandlerType;
10 context?: Context;
11}
12export declare type Status = keyof typeof StatusType;
13export declare type LogsGlobal = ReturnType<typeof makeLogsGlobal>;
14export declare const datadogLogs: {
15 logger: Logger;
16 init: (userConfiguration: LogsUserConfiguration) => void;
17 setLoggerGlobalContext: (newContext: Context) => void;
18 addLoggerGlobalContext: (key: string, value: ContextValue) => void;
19 removeLoggerGlobalContext: (key: string) => void;
20 createLogger: (name: string, conf?: LoggerConfiguration) => Logger;
21 getLogger: (name: string) => Logger | undefined;
22} & {
23 onReady(callback: () => void): void;
24};
25export declare type StartLogs = typeof startLogs;
26export declare function makeLogsGlobal(startLogsImpl: StartLogs): {
27 logger: Logger;
28 init: (userConfiguration: LogsUserConfiguration) => void;
29 setLoggerGlobalContext: (newContext: Context) => void;
30 addLoggerGlobalContext: (key: string, value: ContextValue) => void;
31 removeLoggerGlobalContext: (key: string) => void;
32 createLogger: (name: string, conf?: LoggerConfiguration) => Logger;
33 getLogger: (name: string) => Logger | undefined;
34} & {
35 onReady(callback: () => void): void;
36};