-
Notifications
You must be signed in to change notification settings - Fork 7
/
logger.ts
51 lines (46 loc) · 949 Bytes
/
logger.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
import config from '../configs/config';
import bunyan from '../configs/logger';
/**
* Logger class used in the project.
*
* @export
* @class Logger
*/
export class Logger {
/**
* Log error message
* @param {string} message
* @memberof Logger
*/
/* istanbul ignore next */
public error(message: string): void {
if (config.ENV === 'dev') {
bunyan.error(message);
}
}
/**
* Logs info message.
*
* @param {string} message
* @memberof Logger
*/
/* istanbul ignore next */
public info(message: string): void {
if (config.ENV === 'dev' || config.ENV === 'test') {
bunyan.info(message);
}
}
/**
* Log warn message.
*
* @param {string} message
* @memberof Logger
*/
/* istanbul ignore next */
public warn(message: string): void {
if (config.ENV === 'dev' || config.ENV === 'test') {
bunyan.warn(message);
}
}
}
export default new Logger();