-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
151 lines (129 loc) · 4.06 KB
/
index.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
// Type definitions for debug-sx
// see also: https://www.typescriptlang.org/docs/handbook/modules.html
// https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require
// https://www.typescriptlang.org/docs/handbook/declaration-files/by-example.html
declare let debugsx: debugsx.IDebug;
export = debugsx;
export as namespace debugsx;
declare namespace debugsx {
export interface IDebug {
(namespace: string): debug.IDebugger,
coerce: (val: any) => any,
disable: () => void,
enable: (namespaces: string) => void,
enabled: (namespaces: string) => boolean,
// names: string[],
// skips: string[],
locationEnable: (namespaces: string) => void,
locationEnabled: (namespaces: string) => boolean,
formatters: IFormatters,
handlers: IHandler [],
loggers: IDebugger [],
createDebug (namespace: string, opts?: IInspectOpts): IDebugger,
createConsoleHandler (fd?: string, namespaces?: string, locationNamespaces?: string, colors?: IColor []): IHandler,
createConsoleHandler (config: IConsoleHandlerConfig): IHandler,
createRawConsoleHandler (namespaces?: string, locationNamespaces?: string): IHandler,
createFileHandler (filename:string, namespaces?: string, locationNamespaces?: string, colors?: IColor []): IHandler,
createFileHandler (config: IFileHandlerConfig): IHandler,
createSimpleLogger (namespace: string): ISimpleLogger,
createDefaultLogger (namespace: string): IDefaultLogger,
createFullLogger (namespace: string): IFullLogger,
addHandler: (...handler: IHandler []) => void,
removeHandler: (handler: IHandler) => boolean
}
export interface IDebugger {
(formatter: any, ...args: any[]): void;
enabled: boolean;
locationEnabled: boolean;
log: Function;
namespace: string;
activeHandlers : IActiveHandler [];
}
export interface IFormatters {
[formatter: string]: Function
}
export interface IInspectOpts {
showHidden?: boolean;
depth?: number;
colors?: boolean;
customInspect?: boolean;
showProxy?: boolean;
maxArrayLength?: number;
breakLength?: number;
}
export interface IActiveHandler {
handler: IHandler;
colorOn: string;
colorOff: string;
locationEnabled: boolean;
}
export interface IHandler {
hstream: IHandlerWriteStream | IHandlerFileStream | IHandlerConsoleStream;
namespaces: string;
locationNamespaces: string;
colors: string,
names: RegExp [],
skips: RegExp [],
location: { names: RegExp [], skips: RegExp [] },
colorTable: string
end(): void;
enabled(name: string): boolean;
locationEnabled(name: string): boolean;
getColorCodes(module: string, level:string): IColorCodes;
}
export interface IHandlerWriteStream {
wstream: NodeJS.WritableStream;
writable: boolean;
write(buffer: Buffer | string, cb?: Function): boolean;
write(str: string, encoding?: string, cb?: Function): boolean;
end(): void;
}
export interface IHandlerFileStream extends IHandlerWriteStream {
filename: string;
}
export interface IHandlerConsoleStream extends IHandlerWriteStream {
name: string;
}
export interface IColorCodes {
on: string;
off: string;
}
export interface IColor {
color: string;
namespace?: string | RegExp;
level?: string | RegExp;
module?: string | RegExp;
inverse?: boolean;
}
export interface IFileHandlerConfig {
filename: string,
namespaces?: string;
locationNamespaces?: string,
colors?: string
}
export interface IConsoleHandlerConfig {
fd: string,
namespaces?: string;
locationNamespaces?: string,
colors?: string
}
export interface ISimpleLogger {
info: IDebugger;
warn: IDebugger;
}
export interface IDefaultLogger {
fine: IDebugger;
config: IDebugger;
info: IDebugger;
warn: IDebugger;
}
export interface IFullLogger {
finest: IDebugger;
finer: IDebugger;
fine: IDebugger;
config: IDebugger;
info: IDebugger;
warn: IDebugger;
severe: IDebugger;
}
}