This repository has been archived by the owner on Apr 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.d.ts
70 lines (53 loc) · 1.97 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
declare module 'loggaby' {
interface LoggabyLevel {
/** Whether to make the level name and message bold and underline (to be noticeable). */
fatal?: boolean;
/** Whether this level will be hidden when <code>options.debug</code> is false. */
debug?: boolean;
/** Color of the level name. Accepted values are hex or {@link https://github.com/Luvella/AnsiKit#colors named colors}. */
color: string;
/** Name to use as the function call. */
call?: string;
/** Name of the level that appears in the logs. */
name: string;
[x: string]: any;
}
interface Options {
/** Transports to post logs to. */
transports?: Transport[];
/** Logging levels to provide. */
levels?: LoggabyLevel[];
/** Format for how logs should look */
format?: string;
/** Whether to post debug logs. Can be a boolean or `'auto'` */
debug?: boolean | 'auto';
}
export const levels: {
[x in 'log' | 'debug' | 'error' | 'fatal' | 'warn']: LoggabyLevel;
};
/** The base transport class. */
export abstract class Transport {
/**
* Creates a new transport.
* @param options Options for the Transport
*/
constructor(options?: { color?: boolean; });
/**
* Posts content to the transport.
* @param args Any additional arguments to pass in
*/
public abstract transmit(...args: any[]): void;
}
/** A terminal Transport, to post logs to your terminal. */
export const TerminalTransport: new (options?: { color?: boolean; }) => Transport;
class LoggabyInstance {
constructor(options?: Options);
public transports: Transport[];
public options: Options;
public format: string;
}
type LogFunction = (...message: unknown[]) => void;
type LoggabyConstructor = new <L extends string = keyof typeof levels>(options?: Options) => LoggabyInstance & Record<L, LogFunction> & Record<keyof typeof levels, LogFunction>;
const Loggaby: LoggabyConstructor;
export default Loggaby;
}