1 |
|
2 | import { ConfigParams } from 'pip-services3-commons-node';
|
3 | import { LogLevel } from './LogLevel';
|
4 | import { Logger } from './Logger';
|
5 | import { LogMessage } from './LogMessage';
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 | export declare abstract class CachedLogger extends Logger {
|
27 | protected _cache: LogMessage[];
|
28 | protected _updated: boolean;
|
29 | protected _lastDumpTime: number;
|
30 | protected _maxCacheSize: number;
|
31 | protected _interval: number;
|
32 | |
33 |
|
34 |
|
35 | constructor();
|
36 | /**
|
37 | * Writes a log message to the logger destination.
|
38 | *
|
39 | * @param level a log level.
|
40 | * @param correlationId (optional) transaction id to trace execution through call chain.
|
41 | * @param error an error object associated with this message.
|
42 | * @param message a human-readable message to log.
|
43 | */
|
44 | protected write(level: LogLevel, correlationId: string, error: Error, message: string): void;
|
45 | /**
|
46 | * Saves log messages from the cache.
|
47 | *
|
48 | * @param messages a list with log messages
|
49 | * @param callback callback function that receives error or null for success.
|
50 | */
|
51 | protected abstract save(messages: LogMessage[], callback: (err: any) => void): void;
|
52 | /**
|
53 | * Configures component by passing configuration parameters.
|
54 | *
|
55 | * @param config configuration parameters to be set.
|
56 | */
|
57 | configure(config: ConfigParams): void;
|
58 | /**
|
59 | * Clears (removes) all cached log messages.
|
60 | */
|
61 | clear(): void;
|
62 | /**
|
63 | * Dumps (writes) the currently cached log messages.
|
64 | *
|
65 | * @see [[write]]
|
66 | */
|
67 | dump(): void;
|
68 | /**
|
69 | * Makes message cache as updated
|
70 | * and dumps it when timeout expires.
|
71 | *
|
72 | * @see [[dump]]
|
73 | */
|
74 | protected update(): void;
|
75 | }
|