forked from chjj/blessed
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwidget-log.js
48 lines (42 loc) · 809 Bytes
/
widget-log.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
var blessed = require('../')
, screen;
screen = blessed.screen({
dump: __dirname + '/logs/logger.log',
smartCSR: true,
autoPadding: false,
warnings: true
});
var logger = blessed.log({
parent: screen,
top: 'center',
left: 'center',
width: '50%',
height: '50%',
border: 'line',
tags: true,
keys: true,
vi: true,
mouse: true,
scrollback: 100,
scrollbar: {
ch: ' ',
track: {
bg: 'yellow'
},
style: {
inverse: true
}
}
});
logger.focus();
setInterval(function() {
logger.log('Hello {#0fe1ab-fg}world{/}: {bold}%s{/bold}.', Date.now().toString(36));
if (Math.random() < 0.30) {
logger.log({foo:{bar:{baz:true}}});
}
screen.render();
}, 1000).unref();
screen.key('q', function() {
return screen.destroy();
});
screen.render();