-
Notifications
You must be signed in to change notification settings - Fork 0
/
NullLogger.ts
101 lines (90 loc) · 3.88 KB
/
NullLogger.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/** @module log */
import { ILogger } from './ILogger';
import { LogLevel } from './LogLevel';
/**
* Dummy implementation of logger that doesn't do anything.
*
* It can be used in testing or in situations when logger is required
* but shall be disabled.
*
* @see [[ILogger]]
*/
export class NullLogger implements ILogger {
/**
* Creates a new instance of the logger.
*/
public constructor() { }
/**
* Gets the maximum log level.
* Messages with higher log level are filtered out.
*
* @returns the maximum log level.
*/
public getLevel(): LogLevel { return LogLevel.None; }
/**
* Set the maximum log level.
*
* @param value a new maximum log level.
*/
public setLevel(value: LogLevel): void { }
/**
* Logs a message at specified log level.
*
* @param level a log level.
* @param correlationId (optional) transaction id to trace execution through call chain.
* @param error an error object associated with this message.
* @param message a human-readable message to log.
* @param args arguments to parameterize the message.
*/
public log(level: LogLevel, correlationId: string, error: Error, message: string, ...args: any[]): void { }
/**
* Logs fatal (unrecoverable) message that caused the process to crash.
*
* @param correlationId (optional) transaction id to trace execution through call chain.
* @param error an error object associated with this message.
* @param message a human-readable message to log.
* @param args arguments to parameterize the message.
*/
public fatal(correlationId: string, error: Error, message: string, ...args: any[]): void { }
/**
* Logs recoverable application error.
*
* @param correlationId (optional) transaction id to trace execution through call chain.
* @param error an error object associated with this message.
* @param message a human-readable message to log.
* @param args arguments to parameterize the message.
*/
public error(correlationId: string, error: Error, message: string, ...args: any[]): void { }
/**
* Logs a warning that may or may not have a negative impact.
*
* @param correlationId (optional) transaction id to trace execution through call chain.
* @param message a human-readable message to log.
* @param args arguments to parameterize the message.
*/
public warn(correlationId: string, message: string, ...args: any[]): void { }
/**
* Logs an important information message
*
* @param correlationId (optional) transaction id to trace execution through call chain.
* @param message a human-readable message to log.
* @param args arguments to parameterize the message.
*/
public info(correlationId: string, message: string, ...args: any[]): void { }
/**
* Logs a high-level debug information for troubleshooting.
*
* @param correlationId (optional) transaction id to trace execution through call chain.
* @param message a human-readable message to log.
* @param args arguments to parameterize the message.
*/
public debug(correlationId: string, message: string, ...args: any[]): void { }
/**
* Logs a low-level debug information for troubleshooting.
*
* @param correlationId (optional) transaction id to trace execution through call chain.
* @param message a human-readable message to log.
* @param args arguments to parameterize the message.
*/
public trace(correlationId: string, message: string, ...args: any[]): void { }
}