1 // flow-typed signature: 71d87edbd93b4e1027b7e590a8e97a21
2 // flow-typed version: 097f6f2b81/winston_v3.x.x/flow_>=v0.104.x
4 declare type
$winstonLevels
= { [string
]: number
, ... };
6 declare type
$winstonNpmLogLevels
= {
16 declare type
$winstonInfo
<T
: $winstonLevels
> = {
17 [optionName
: string
]: mixed
,
23 declare type
$winstonFormat
= Object
;
25 declare type
$winstonFileTransportConfig
<T
: $winstonLevels
> = {
31 declare
class $winstonTransport
{
36 declare
class $winstonFileTransport
<T
> extends $winstonTransport
{
37 constructor($winstonFileTransportConfig
<T
>): $winstonFileTransport
<T
>;
40 declare type
$winstonConsoleTransportConfig
<T
: $winstonLevels
> = { level
?: $Keys
<T
>, ... };
42 declare
class $winstonConsoleTransport
<T
> extends $winstonTransport
{
44 config
?: $winstonConsoleTransportConfig
<T
>
45 ): $winstonConsoleTransport
<T
>;
48 declare type
$winstonLoggerConfig
<T
: $winstonLevels
> = {
49 exitOnError
?: boolean,
50 format
?: $winstonFormat
,
53 transports
?: Array
<$winstonTransport
>,
57 declare 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,
70 declare type
$winstonConfigSubModule
= { npm
: () => $winstonNpmLogLevels
, ... };
72 declare type
$winstonFormatJsonOptions
= {
73 replacer
?: (key
: string
, value
: mixed
) => mixed
,
79 declare type
$winstonFormatPrettyPrintOptions
= {|
84 declare type
$winstonFormatErrorsOptions
= {|
88 declare 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
,
99 format
?: string
| () => string
,
101 }) => $winstonFormat
,
102 colorize
: () => $winstonFormat
,
103 logstash
: () => $winstonFormat
,
104 printf
: ((args
: $winstonInfo
<Object
>) => string
) => $winstonFormat
,
105 errors
: (options
?: $winstonFormatErrorsOptions
) => $winstonFormat
,
109 declare type
$winstonDefaultLogger
= $winstonLogger
<$winstonNpmLogLevels
>;
111 declare
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;
119 declare
interface $winstonProfiler
<T
: $winstonNpmLogLevels
> {
120 logger
: $winstonLogger
<T
>;
122 done(info
?: $Shape
<$winstonInfo
<T
>>): void;
125 declare 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
>;
143 declare module
.exports
: {
144 ...$Exact
<$winstonDefaultLogger
>,
145 format
: $winstonFormatSubModule
,
147 Console
: typeof $winstonConsoleTransport
,
148 File
: typeof $winstonFileTransport
,
151 createLogger
: <T
>($winstonLoggerConfig
<T
>) => $winstonLogger
<T
>,
152 Container
: typeof $winstonContainer
,
153 loggers
: $winstonContainer
<*>,