UNPKG

3.53 kBTypeScriptView Raw
1/** @module log */
2import { LogLevel } from './LogLevel';
3/**
4 * Interface for logger components that capture execution log messages.
5 */
6export interface ILogger {
7 /**
8 * Gets the maximum log level.
9 * Messages with higher log level are filtered out.
10 *
11 * @returns the maximum log level.
12 */
13 getLevel(): LogLevel;
14 /**
15 * Set the maximum log level.
16 *
17 * @param value a new maximum log level.
18 */
19 setLevel(value: LogLevel): void;
20 /**
21 * Logs a message at specified log level.
22 *
23 * @param level a log level.
24 * @param correlationId (optional) transaction id to trace execution through call chain.
25 * @param error an error object associated with this message.
26 * @param message a human-readable message to log.
27 * @param args arguments to parameterize the message.
28 */
29 log(level: LogLevel, correlationId: string, error: Error, message: string, ...args: any[]): void;
30 /**
31 * Logs fatal (unrecoverable) message that caused the process to crash.
32 *
33 * @param correlationId (optional) transaction id to trace execution through call chain.
34 * @param error an error object associated with this message.
35 * @param message a human-readable message to log.
36 * @param args arguments to parameterize the message.
37 */
38 fatal(correlationId: string, error: Error, message: string, ...args: any[]): void;
39 /**
40 * Logs recoverable application error.
41 *
42 * @param correlationId (optional) transaction id to trace execution through call chain.
43 * @param error an error object associated with this message.
44 * @param message a human-readable message to log.
45 * @param args arguments to parameterize the message.
46 */
47 error(correlationId: string, error: Error, message: string, ...args: any[]): void;
48 /**
49 * Logs a warning that may or may not have a negative impact.
50 *
51 * @param correlationId (optional) transaction id to trace execution through call chain.
52 * @param message a human-readable message to log.
53 * @param args arguments to parameterize the message.
54 */
55 warn(correlationId: string, message: string, ...args: any[]): void;
56 /**
57 * Logs an important information message
58 *
59 * @param correlationId (optional) transaction id to trace execution through call chain.
60 * @param message a human-readable message to log.
61 * @param args arguments to parameterize the message.
62 */
63 info(correlationId: string, message: string, ...args: any[]): void;
64 /**
65 * Logs a high-level debug information for troubleshooting.
66 *
67 * @param correlationId (optional) transaction id to trace execution through call chain.
68 * @param message a human-readable message to log.
69 * @param args arguments to parameterize the message.
70 */
71 debug(correlationId: string, message: string, ...args: any[]): void;
72 /**
73 * Logs a low-level debug information for troubleshooting.
74 *
75 * @param correlationId (optional) transaction id to trace execution through call chain.
76 * @param message a human-readable message to log.
77 * @param args arguments to parameterize the message.
78 */
79 trace(correlationId: string, message: string, ...args: any[]): void;
80}