-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.js
More file actions
31 lines (24 loc) · 810 Bytes
/
example.js
File metadata and controls
31 lines (24 loc) · 810 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
const logger = require('./index.js')();
logger.setLogLevel('info');
logger.setLogLevel('warn');
logger.setLogLevel('none');
logger.setLogLevel('all');
logger.setIconsEnabled(true);
logger.success('Hello, world!\n');
logger.warn('Hello, world!\n');
logger.info('Hello, world!\n');
logger.error('Hello, world!\n');
logger.muted('Hello, world!\n');
logger.log('Hello, world!\n');
// ...or alternatively (with namespace)
const namespacedLogger = require('./index.js')('my-namespace');
namespacedLogger.setSeperator(':');
namespacedLogger.warn('Hello, world!\n');
// ...or alternatively (with options)
const { getLogger } = require('./index.js');
const otherNamespacedLogger = getLogger({
prefix: 'my-other-namespace',
icons: true,
seperator: ':',
});
otherNamespacedLogger.success('Hello, world!\n');