forked from matsuro-hadouken/casper-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlog.sh
48 lines (31 loc) · 1.52 KB
/
log.sh
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
#!/bin/bash
# REQUIREMENTS:
# 'node, npm''
# 'npm install log-color-highlight -g'
# 'sudo apt install jq'
# color Highlighting color, style, preset or modifier. Allowed values:
# Colors: black red green yellow blue magenta cyan white gray
# Background colors: bgBlack bgRed bgGreen bgYellow bgBlue bgMagenta bgCyan bgWhite
# Styles: reset bold dim italic underline inverse hidden strikethrough
# Presets: any preset defined with '-p' parameter
LOG_PATH='/home/casper/.casperlabs/log.0.txt'
HANDLING='Handling incoming message='
UNCAUGHT='Uncaught Exception :'
FINISHED='Finished handling incoming message='
ATTEMPTING='Attempting to add is_booking_block='
ADD_MESSAGE='Added message='
PEER_SIZE='Peers: size='
EXE='Executing action='
CREATE='Created kind='
F_CREATE='Finished handling created message='
SCHEDULE='Scheduling action='
ERA_CREATED='Created era='
LFB='New last finalized block'
ERROR='error'
VOTE='vote any main child'
APPROVAL='Added new approval'
METRIX_REPORT='Reporting metrics to destination='
STARTING="Starting node"
LISTENING="Listening"
REQUIRED='reached required min_successful'
tail -f $LOG_PATH | jq '.text | .message | select (.!=null)' | lch -red.wl "$UNCAUGHT" "$ERROR" "$VOTE" "$REQUIRED" -yellow.wl "$HANDLING" -white.bold.wl "$ATTEMPTING" -green.wl "$LISTENING" "$FINISHED" "$APPROVAL" "$METRIX_REPORT" "$ADD_MESSAGE" -cyan.wl "$PEER_SIZE" "$F_CREATE" -magenta.wl "$EXE" "$CREATE" "$STARTING" "$SCHEDULE" "$LFB" -red.bold "$ERA_CREATED"