Simplify DC current output type handling.
[e-mobility-charging-stations-simulator.git] / flow-typed / npm / winston_v3.x.x.js
CommitLineData
7dde0b73
JB
1// flow-typed signature: 71d87edbd93b4e1027b7e590a8e97a21
2// flow-typed version: 097f6f2b81/winston_v3.x.x/flow_>=v0.104.x
3
4declare type $winstonLevels = { [string]: number, ... };
5
6declare type $winstonNpmLogLevels = {
7 error: number,
8 warn: number,
9 info: number,
10 verbose: number,
11 debug: number,
12 silly: number,
13 ...
14};
15
16declare type $winstonInfo<T: $winstonLevels> = {
17 [optionName: string]: mixed,
18 level: $Keys<T>,
19 message: string,
20 ...
21};
22
23declare type $winstonFormat = Object;
24
25declare type $winstonFileTransportConfig<T: $winstonLevels> = {
26 filename: string,
27 level?: $Keys<T>,
28 ...
29};
30
31declare class $winstonTransport {
32 level?: string;
33 silent?: boolean;
34}
35
36declare class $winstonFileTransport<T> extends $winstonTransport {
37 constructor($winstonFileTransportConfig<T>): $winstonFileTransport<T>;
38}
39
40declare type $winstonConsoleTransportConfig<T: $winstonLevels> = { level?: $Keys<T>, ... };
41
42declare class $winstonConsoleTransport<T> extends $winstonTransport {
43 constructor(
44 config?: $winstonConsoleTransportConfig<T>
45 ): $winstonConsoleTransport<T>;
46}
47
48declare type $winstonLoggerConfig<T: $winstonLevels> = {
49 exitOnError?: boolean,
50 format?: $winstonFormat,
51 level?: $Keys<T>,
52 levels?: T,
53 transports?: Array<$winstonTransport>,
54 ...
55};
56
57declare type $winstonLogger<T: $winstonLevels> = {
58 [$Keys<T>]: (message: string, meta?: Object) => $winstonLogger<T>,
59 add: $winstonTransport => $winstonLogger<T>,
60 remove: $winstonTransport => $winstonLogger<T>,
61 clear: () => $winstonLogger<T>,
62 close: () => $winstonLogger<T>,
63 configure: ($winstonLoggerConfig<T>) => void,
64 log: (message: $winstonInfo<T>) => $winstonLogger<T>,
65 startTimer: () => $winstonProfiler<T>,
66 profile: (name: string, info?: $Shape<$winstonInfo<T>>) => void,
67 ...
68};
69
70declare type $winstonConfigSubModule = { npm: () => $winstonNpmLogLevels, ... };
71
72declare type $winstonFormatJsonOptions = {
73 replacer?: (key: string, value: mixed) => mixed,
74 space?: number,
75 stable?: boolean,
76 ...
77};
78
79declare type $winstonFormatPrettyPrintOptions = {|
80 depth?: number,
81 colorize?: boolean,
82|};
83
84declare type $winstonFormatErrorsOptions = {|
85 stack?: boolean,
86|};
87
88declare type $winstonFormatSubModule = {
89 <T: $winstonLevels>((info: $winstonInfo<T>) => $winstonInfo<T>): () => $winstonFormat,
90 combine: (...args: Array<$winstonFormat>) => $winstonFormat,
91 json: (options?: $winstonFormatJsonOptions) => $winstonFormat,
92 label: (config?: Object) => $winstonFormat,
93 metadata: () => $winstonFormat,
94 prettyPrint: (options?: $winstonFormatPrettyPrintOptions) => $winstonFormat,
95 simple: () => $winstonFormat,
96 splat: () => $winstonFormat,
97 timestamp: (?{
98 alias?: string,
99 format?: string | () => string,
100 ...
101 }) => $winstonFormat,
102 colorize: () => $winstonFormat,
103 logstash: () => $winstonFormat,
104 printf: ((args: $winstonInfo<Object>) => string) => $winstonFormat,
105 errors: (options?: $winstonFormatErrorsOptions) => $winstonFormat,
106 ...
107};
108
109declare type $winstonDefaultLogger = $winstonLogger<$winstonNpmLogLevels>;
110
111declare class $winstonContainer<T> {
112 constructor(config?: $winstonLoggerConfig<T>): $winstonContainer<T>;
113 add(loggerId: string, config?: $winstonLoggerConfig<T>): $winstonLogger<T>;
114 get(loggerId: string): $winstonLogger<T>;
115 has(loggerId: string): boolean;
116 close(loggerId?: string): void;
117}
118
119declare interface $winstonProfiler<T: $winstonNpmLogLevels> {
120 logger: $winstonLogger<T>;
121 start: Date;
122 done(info?: $Shape<$winstonInfo<T>>): void;
123};
124
125declare module "winston" {
126 declare export type Levels = $winstonLevels;
127 declare export type NpmLogLevels = $winstonNpmLogLevels;
128 declare export type Info<T: Levels > = $winstonInfo<T>;
129 declare export type Format = $winstonFormat;
130 declare export type FileTransportConfig<T: Levels> = $winstonFileTransportConfig<T>;
131 declare export type Transport = $winstonTransport;
132 declare export type FileTransport<T: Levels> = $winstonFileTransport<T>;
133 declare export type ConsoleTransportConfig<T: Levels> = $winstonConsoleTransportConfig<T>;
134 declare export type ConsoleTransport<T: Levels> = $winstonConsoleTransport<T>;
135 declare export type LoggerConfig<T: Levels> = $winstonLoggerConfig<T>;
136 declare export type Logger<T: Levels> = $winstonLogger<T>;
137 declare export type ConfigSubModule = $winstonConfigSubModule;
138 declare export type FormatSubModule = $winstonFormatSubModule;
139 declare export type DefaultLogger = $winstonDefaultLogger;
140 declare export type Container<T: Levels> = $winstonContainer<T>;
141 declare export type Profiler<T: Levels> = $winstonProfiler<T>;
142
143 declare module.exports: {
144 ...$Exact<$winstonDefaultLogger>,
145 format: $winstonFormatSubModule,
146 transports: {
147 Console: typeof $winstonConsoleTransport,
148 File: typeof $winstonFileTransport,
149 ...
150 },
151 createLogger: <T>($winstonLoggerConfig<T>) => $winstonLogger<T>,
152 Container: typeof $winstonContainer,
153 loggers: $winstonContainer<*>,
154 ...
155 };
156}