-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy path4-function.js
More file actions
31 lines (25 loc) · 633 Bytes
/
Copy path4-function.js
File metadata and controls
31 lines (25 loc) · 633 Bytes
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
'use strict';
const COLORS = {
warning: '\x1b[1;33m',
error: '\x1b[0;31m',
info: '\x1b[1;37m',
};
const logger = (level = 'info') => {
const color = COLORS[level];
return (message) => {
const date = new Date().toISOString();
console.log(`${color}${date}\t${message}`);
};
};
/*
const logger = (level = 'info', color = COLORS[level]) => (message) => {
const date = new Date().toISOString();
console.log(`${color}${date}\t${message}`);
};
*/
const warning = logger('warning');
warning('Hello warning');
const error = logger('error');
error('Hello error');
const info = logger('info');
info('Hello info');