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