Turn off all control chars when logging to file under systemd

This commit is contained in:
Bobbi Webber-Manners 2020-07-28 14:40:01 -04:00
parent e32b2a4423
commit 409e624219
1 changed files with 6 additions and 3 deletions

View File

@ -81,13 +81,16 @@ def appendbyte(l, b, csin):
def printinfo(drv, blknum, isWrite, isError, cs):
global systemd, prevblk, prevdrv, prevop, prevcs, col
if drv != prevdrv:
print('\n{}Drive {}{}'.format(BLU, drv, ENDC))
col = 0
if systemd:
print('\nDrive {}'.format(drv))
else:
print('\n{}Drive {}{}'.format(BLU, drv, ENDC))
col = 0
e = '+' if ((blknum == prevblk) and (drv == prevdrv) and (isWrite == prevop) and (cs == prevcs)) else ' '
e = 'X' if isError else e
if systemd:
c = 'W' if isWrite else 'R'
print(' {0}{1}{2:05d}{3}'.format(e, c, blknum, ENDC), end='', flush=True)
print(' {0}{1}{2:05d}'.format(e, c, blknum), end='', flush=True)
else:
c = RED if isWrite else GRN
print('{0} {1}{2:05d}{3}'.format(c, e, blknum, ENDC), end='', flush=True)