-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
49 lines (49 loc) · 1.02 KB
/
index.js
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
class Logger {
constructor() {}
/**
* logger 配置项
*/
config = {
primary: "#007aff",
success: "#4cd964",
warning: "#f0ad4e",
error: "#dd524d",
};
/**
*
* @param {String} str
* @description output a text with success color in console
*/
success(str) {
console(`%c${str}`, `color:${this.config.success}`);
}
/**
*
* @param {String} str
* @description output a text with warning color in console
*/
warning(str) {
console(`%c${str}`, `color:${this.config.warning}`);
}
/**
*
* @param {String} str
* @description output a text with error color in console
*/
error(str) {
console(`%c${str}`, `color:${this.config.error}`);
}
/**
*
* @param {String} url
* @param {String} style
* @description output a picture in console
*/
picture(
url,
style = "padding-left:80px;padding-bottom: 80px;border-radius:50%;"
) {
console.log("%c", `background: url(${url}) no-repeat center;${style}`);
}
}
export default new Logger();