forked from winstonjs/logform
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
53 lines (44 loc) · 1.74 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
// Type definitions for logform 1.2
// Project: https://github.com/winstonjs/logform
// Definitions by: DABH <https://github.com/DABH>
// Definitions: https://github.com/winstonjs/logform
// TypeScript Version: 2.2
export interface TransformableInfo {
level: string;
message: string;
[key: string]: any;
}
export type TransformFunction = (info: TransformableInfo, opts?: any) => TransformableInfo | boolean;
export type Colors = { [key: string]: string | string[] }; // tslint:disable-line interface-over-type-literal
export type FormatWrap = (opts?: any) => Format;
export class Format {
constructor(opts?: object);
options?: object;
transform: TransformFunction;
}
export class Colorizer extends Format {
constructor(opts?: object);
createColorize: (opts?: object) => Colorizer;
addColors: (colors: Colors) => Colors;
colorize: (level: string, message: string) => string;
}
export function format(transform: TransformFunction): FormatWrap;
export function levels(config: object): object;
export namespace format {
function align(opts?: object): Format;
function cli(opts?: object): Format;
function colorize(opts?: object): Colorizer;
function combine(...formats: Format[]): Format;
function json(opts?: object): Format;
function label(opts?: object): Format;
function logstash(opts?: object): Format;
function metadata(opts?: object): Format;
function ms(opts?: object): Format;
function padLevels(opts?: object): Format;
function prettyPrint(opts?: object): Format;
function printf(templateFunction: (info: TransformableInfo) => string): Format;
function simple(opts?: object): Format;
function splat(opts?: object): Format;
function timestamp(opts?: object): Format;
function uncolorize(opts?: object): Format;
}