File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -361,8 +361,25 @@ def drain(self):
361361 if not data :
362362 break
363363 # kmsg format: "priority,sequence,timestamp,-;message\n"
364- # Just keep the raw lines — hwksft doesn't parse them.
365- lines .append (data .decode ('utf-8' , 'ignore' ))
364+ # Convert to dmesg-style: "[ timestamp] message"
365+ raw = data .decode ('utf-8' , 'ignore' )
366+ for raw_line in raw .splitlines ():
367+ parts = raw_line .split (';' , 1 )
368+ if len (parts ) == 2 :
369+ header , msg = parts
370+ fields = header .split (',' )
371+ if len (fields ) >= 3 :
372+ # timestamp is in microseconds
373+ try :
374+ ts_us = int (fields [2 ])
375+ ts_s = ts_us / 1_000_000
376+ lines .append (f'[{ ts_s :>12.6f} ] { msg } \n ' )
377+ except ValueError :
378+ lines .append (f'{ msg } \n ' )
379+ else :
380+ lines .append (f'{ msg } \n ' )
381+ else :
382+ lines .append (f'{ raw_line } \n ' )
366383
367384 return '' .join (lines )
368385
You can’t perform that action at this time.
0 commit comments