Skip to content

Commit

Permalink
log: add ppid
Browse files Browse the repository at this point in the history
  • Loading branch information
bigtree9307 committed Mar 12, 2019
1 parent 4ee7873 commit 7e3f413
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions coloredlogcat.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,13 @@

# Width of various columns; set to -1 to hide
TIME_WIDTH = 18
PPID_WIDTH = 7
USER_WIDTH = 3
PROCESS_WIDTH = 8
PROCESS_WIDTH = 7
TAG_WIDTH = 20
PRIORITY_WIDTH = 3

HEADER_SIZE = TIME_WIDTH + USER_WIDTH + PROCESS_WIDTH + TAG_WIDTH + PRIORITY_WIDTH + 4
HEADER_SIZE = TIME_WIDTH + PPID_WIDTH + USER_WIDTH + PROCESS_WIDTH + TAG_WIDTH + PRIORITY_WIDTH + 6

# unpack the current terminal width/height
data = fcntl.ioctl(sys.stdout.fileno(), termios.TIOCGWINSZ, '1234')
Expand Down Expand Up @@ -168,7 +169,7 @@ def millis_color(match):

# time
if TIME_WIDTH > 0:
linebuf.write(time)
linebuf.write("%s%s%s " % (format(fg=GREEN, bg=BLACK, bright=False), time, format(reset=True)))

# center user info
if USER_WIDTH > 0:
Expand All @@ -181,6 +182,11 @@ def millis_color(match):
else:
linebuf.write(" " * (USER_WIDTH + 1))

# ppid
if PPID_WIDTH > 0:
ppid = ppid.strip().center(PPID_WIDTH)
linebuf.write("%s%s%s " % (format(fg=BLACK, bg=BLACK, bright=True), ppid, format(reset=True)))

# center process info
if PROCESS_WIDTH > 0:
process = process.strip().center(PROCESS_WIDTH)
Expand Down

0 comments on commit 7e3f413

Please sign in to comment.