Index

lognestmonster / 000f5ab

A general-purpose single-header C logging library and parser for event-based logs. (Incomplete)

Latest Commit

{#}TimeHashSubjectAuthor#(+)(-)GPG?
6813 Aug 2019 21:02000f5abBegin parserJosh Stockin1400N

Blob @ lognestmonster / parser / utils.py

application/x-python693 bytesdownload raw
1# get character from stdin
2
3import termios, sys, tty
4def getch():
5 fd = sys.stdin.fileno()
6 old_settings = termios.tcgetattr(fd)
7 try:
8 tty.setraw(fd)
9 ch = sys.stdin.read(1)
10 finally:
11 termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
12 return ch
13
14
15# echo output
16
17import subprocess
18def output(*array):
19 s = "".join(array)
20 a=subprocess.run(["echo", "-e", s]);
21
22
23# ANSI codes for output
24
25RESET = "\e[0m"
26BOLD = "\e[1m"
27UNDERLINED = "\e[4m"
28CONTRAST = "\e[7m"
29
30TEXT_RED = "\e[91m"
31TEXT_GREEN = "\e[92m"
32TEXT_YELLOW = "\e[93m"
33TEXT_MAGENTA = "\e[95m"
34TEXT_CYAN = "\e[96m"
35
36BACK_RED = "\e[101m"
37BACK_GREEN = "\e[102m"
38BACK_YELLOW = "\e[103m"
39BACK_MAGENTA = "\e[105m"
40BACK_CYAN = "\e[106m"
41