-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.d.ts
98 lines (81 loc) · 3.14 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
import {WriteStream} from 'fs';
declare module '@smpx/oak' {
interface plainObject {
[key: string]: any;
}
type level = 'error' | 'warn' | 'info' | 'verbose' | 'debug' | 'silly';
class BasicLogs {
constructor(opts?: {level?: level});
log(info: plainObject): void;
static formatter(info: plainObject): any;
static filterLogs(info: plainObject, level: level): boolean;
}
class ConsoleLogs extends BasicLogs {
}
class FileLogs extends BasicLogs {
constructor(opts: {level?: level, path: string, table: string, filter: boolean})
static _getStream(opts: {path: string, table: string, regenerate?: boolean}): WriteStream;
}
class Oak {
constructor(opts?: object | string);
updateOptions(opts: object): void;
getChild<T extends Oak>(this: T, opts?: object | string): T;
setTransports<T extends BasicLogs>(transports: T | T[]): void;
log(...args: any[]): void;
log(opts: plainObject, ...args: any[]): void;
silly(...args: any[]): void;
silly(opts: plainObject, ...args: any[]): void;
debug(...args: any[]): void;
debug(opts: plainObject, ...args: any[]): void;
verbose(...args: any[]): void;
verbose(opts: plainObject, ...args: any[]): void;
info(...args: any[]): void;
info(opts: plainObject, ...args: any[]): void;
warn(...args: any[]): void;
warn(opts: plainObject, ...args: any[]): void;
error(...args: any[]): void;
error(opts: plainObject, ...args: any[]): void;
time(key?: string): string | number;
timeEnd(key:string | number, ...arg: any[]): number;
logTimeTaken<T>(fn: () => Promise<T> | T):Promise<T>;
logTimeTaken<T>(message: string, fn: () => Promise<T> | T):Promise<T>;
logTimeTaken<T>(opts: object, message: string, fn: () => Promise<T> | T):Promise<T>;
options: {
[key: string]: any,
};
_isOak: true;
static _isOak: true;
static log(...args: any[]): void;
static log(opts: plainObject, ...args: any[]): void;
static silly(...args: any[]): void;
static silly(opts: plainObject, ...args: any[]): void;
static debug(...args: any[]): void;
static debug(opts: plainObject, ...args: any[]): void;
static verbose(...args: any[]): void;
static verbose(opts: plainObject, ...args: any[]): void;
static info(...args: any[]): void;
static info(opts: plainObject, ...args: any[]): void;
static warn(...args: any[]): void;
static warn(opts: plainObject, ...args: any[]): void;
static error(...args: any[]): void;
static error(opts: plainObject, ...args: any[]): void;
static time(key?: string): string | number;
static timeEnd(key:string | number, ...arg: any[]): number;
static logTimeTaken<T>(fn: () => Promise<T> | T):Promise<T>;
static logTimeTaken<T>(message: string, fn: () => Promise<T> | T):Promise<T>;
static logTimeTaken<T>(opts: object, message: string, fn: () => Promise<T> | T):Promise<T>;
static installExitHandlers(): void;
static installExceptionHandlers(): void;
static setGlobalOptions(options: plainObject): void;
static setTransports<T extends BasicLogs>(transports: T | T[]): void;
// TODO: convert to function and return T extends Oak type
static default: Oak;
}
export default Oak;
export {
BasicLogs,
FileLogs,
ConsoleLogs,
Oak,
}
}