-
Notifications
You must be signed in to change notification settings - Fork 15
/
api.d.ts
67 lines (63 loc) · 2.43 KB
/
api.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
type LogLevel = "off" | "fatal" | "error" | "warn" | "info" | "debug" | "trace";
export interface IVSCodeExtLogger extends IChildLogger {
/**
* Modify the Logging Level.
* This will affect all child loggers as well.
* Note that the level "off" is used to 'disable' the Logger.
*/
changeLevel(newLevel: LogLevel): void;
/**
* Modify the Log's sourceLocation tracking behavior.
*/
changeSourceLocationTracking(newSourceLocation: boolean): void;
}
export interface IChildLogger {
/**
* @param msg - The Message to log, It may include format specifiers as defined in
* - https://nodejs.org/api/util.html#util_util_format_format_args
* @param [args] - Args can be either:
* - Optional Variable Argument List of values to "replace" the format specifiers:
* myLogger.fatal("Oy %s %d", "Vey", 123) // --> { message: "Oy Vey 123"}
* - Metadata Objects:
* myLogger.fatal("Exec Command", { p1: 666, p2: "foo" }) // --> { message: "Exec Command", p1: 666, p2: "foo"}
* Or a combination of both, however note that format specifier values should appear before
* any metadata objects.
*
*/
fatal(msg: string, ...args: any[]): void;
/**
* @see {IChildLogger.fatal}
*/
error(msg: string, ...args: any[]): void;
/**
* @see {IChildLogger.fatal}
*/
warn(msg: string, ...args: any[]): void;
/**
* @see {IChildLogger.fatal}
*/
info(msg: string, ...args: any[]): void;
/**
* @see {IChildLogger.fatal}
*/
debug(msg: string, ...args: any[]): void;
/**
* @see {IChildLogger.fatal}
*/
trace(msg: string, ...args: any[]): void;
/**
* Will create an logger which uses the **same** log Targets (VSCode outputChannel / Rolling File(?)).
* With one difference: This "child-logger" will prefix its name to the log entries label property.
* This enables distinguishing between logging messages arriving from different sources, e.g:
*
* - Per Class Logger
* - Per Module Logger
* - Per Library Dependency Logger (via dependency injection)
* - ...
*
* Note that the childLoggers are cached using the label as the key, this means that
* One can safely request a (same label) childLogger **multiple times** and not worry about
* memory leaks due to the creation of many objects.
*/
getChildLogger(opts: { label: string }): IChildLogger;
}