@@ -134,26 +134,29 @@ def make_trace_item(fileio: TextIO) -> TraceItemGenerator:
134134 # second trace from the line. This is done by regarding the end position
135135 # of the matched substring as sentinel, timestamp and trace level are
136136 # both some specific offset from the sentinel.
137- span_end_pos = match_obj .span ()[1 ]
138- trace_lvl = line [span_end_pos - 4 : span_end_pos - 1 ]
139137 try :
140- timestamp = float (line [span_end_pos - 19 : span_end_pos - 7 ].strip ())
141- # Support for CONFIG_LOG_OUTPUT_FORMAT_TIME_TIMESTAMP - For when default Zephyr timestamp format is used
142- except ValueError :
143- h , m , rest = line [span_end_pos - 23 : span_end_pos - 7 ].strip ().split (':' )
144- s1 , s2 = rest .split (',' )
145- s = s1 + s2
146- timestamp = timedelta (
147- hours = int (h ),
148- minutes = int (m ),
149- seconds = float (s )
150- ).total_seconds ()
151-
152- # The rest after removing timestamp and log level
153- rest = line [span_end_pos + 1 :].split (': ' )
154- ctx , func = rest [0 :2 ]
155- msg = ': ' .join (rest [2 :]).strip ()
156- yield TraceItem (timestamp , trace_lvl , ctx , func , msg )
138+ span_end_pos = match_obj .span ()[1 ]
139+ trace_lvl = line [span_end_pos - 4 : span_end_pos - 1 ]
140+ try :
141+ timestamp = float (line [span_end_pos - 19 : span_end_pos - 7 ].strip ())
142+ # Support for CONFIG_LOG_OUTPUT_FORMAT_TIME_TIMESTAMP - For when default Zephyr timestamp format is used
143+ except ValueError :
144+ h , m , rest = line [span_end_pos - 23 : span_end_pos - 7 ].strip ().split (':' )
145+ s1 , s2 = rest .split (',' )
146+ s = s1 + s2
147+ timestamp = timedelta (
148+ hours = int (h ),
149+ minutes = int (m ),
150+ seconds = float (s )
151+ ).total_seconds ()
152+
153+ # The rest after removing timestamp and log level
154+ rest = line [span_end_pos + 1 :].split (': ' )
155+ ctx , func = rest [0 :2 ]
156+ msg = ': ' .join (rest [2 :]).strip ()
157+ yield TraceItem (timestamp , trace_lvl , ctx , func , msg )
158+ except Exception as e :
159+ print (f"WARNING: Couldn't parse line: { line } , error: { e } " )
157160
158161def process_trace_file ():
159162 '''The top-level caller for processing the trace file'''
0 commit comments