forked from projen/projen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogging.ts
52 lines (44 loc) · 764 Bytes
/
logging.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
import * as chalk from 'chalk';
let enabled = true;
function log(color: chalk.ChalkFunction, ...text: any[]) {
if (!enabled) { return; }
console.error(`🤖 ${color(...text)}`);
}
/**
* @deprecated
*/
export function debug(...text: any[]) {
if (process.env.DEBUG) {
log(chalk.gray, ...text);
}
}
/**
* @deprecated
*/
export function verbose(...text: any[]) {
log(chalk.white, ...text);
}
/**
* @deprecated
*/
export function info(...text: any[]) {
log(chalk.cyan, ...text);
}
/**
* @deprecated
*/
export function error(...text: any[]) {
log(chalk.red, ...text);
}
/**
* @deprecated
*/
export function warn(...text: any[]) {
log(chalk.yellow, ...text);
}
/**
* @deprecated
*/
export function disable() {
enabled = false;
}