-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample_live_parser.py
More file actions
40 lines (30 loc) · 1.19 KB
/
Copy pathexample_live_parser.py
File metadata and controls
40 lines (30 loc) · 1.19 KB
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
from time import sleep
import traceback
from hslog.live.parser import LiveLogParser
'''
----------------------------------------------------------------------
LiveLogParser assumes that you've configured Power.log to be a symlink
in "SOME_PATH/Hearthstone/Logs" folder:
ln -s Power.log /tmp/hearthstone-redirected.log
this will redirect all data coming into Power.log
so we can access it from a RAM disk
----------------------------------------------------------------------
For better performance make /tmp of type tmpfs (or another location)
in /etc/fstab add line:
tmpfs /tmp tmpfs nodev,nosuid,size=1G 0 0
this will create in-memory storage which is faster then SSD
restart the computer for this to take effect
----------------------------------------------------------------------
'''
def main():
try:
file = '/tmp/hearthstone-redirected.log'
liveParser = LiveLogParser(file)
liveParser.start()
while True:
sleep(1)
except:
print(traceback.format_exc())
liveParser.stop()
if __name__ == "__main__":
main()