1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | import * as Redux from "redux";
|
7 |
|
8 | type LoggerPredicate = (getState: () => any, action: any) => boolean;
|
9 |
|
10 | type StateToString = (state: any) => string;
|
11 | type ActionToString = (action: any) => string;
|
12 | type ErrorToString = (error: any, prevState: any) => string;
|
13 |
|
14 | interface ColorsObject {
|
15 | title?: boolean | ActionToString;
|
16 | prevState?: boolean | StateToString;
|
17 | action?: boolean | ActionToString;
|
18 | nextState?: boolean | StateToString;
|
19 | error?: boolean | ErrorToString;
|
20 | }
|
21 |
|
22 | interface LevelObject {
|
23 | prevState?: string | boolean | StateToString;
|
24 | action?: string | boolean | ActionToString;
|
25 | nextState?: string | boolean | StateToString;
|
26 | error?: string | boolean | ErrorToString;
|
27 | }
|
28 |
|
29 | interface ReduxLoggerOptions {
|
30 | level?: string | ActionToString | LevelObject;
|
31 | duration?: boolean;
|
32 | timestamp?: boolean;
|
33 | colors?: ColorsObject;
|
34 | logger?: any;
|
35 | logErrors?: boolean;
|
36 | collapsed?: boolean | LoggerPredicate;
|
37 | predicate?: LoggerPredicate;
|
38 | stateTransformer?: (state: any) => any;
|
39 | actionTransformer?: (action: any) => any;
|
40 | errorTransformer?: (error: any) => any;
|
41 | diff?: boolean;
|
42 | diffPredicate?: LoggerPredicate;
|
43 | }
|
44 |
|
45 |
|
46 |
|
47 |
|
48 | declare namespace createLogger { }
|
49 | declare function createLogger(options?: ReduxLoggerOptions): Redux.Middleware;
|
50 | export = createLogger;
|