@@ -127,7 +127,7 @@ def _get_level_style(self, level_no: int) -> str:
127127 )
128128 )
129129
130- # This is pretty hacky.. we need to find a way to dynamically set the log level
130+ # Initialise a logger to catch erstrace + other unknown handlertypes from OKS
131131log : logging .Logger = logging .getLogger (__name__ )
132132log .addHandler (FormattedRichHandler (width = get_width ()))
133133log .setLevel ("INFO" )
@@ -168,7 +168,7 @@ def from_string(cls, s: str) -> HandlerType | None:
168168 h = HandlerType (s .lower ())
169169 return h
170170 except :
171- msg = f"{ s } is not a known handler type"
171+ msg = f"[red] { s } [/red] is not a known handler type"
172172 log .warning (msg )
173173 return None
174174
@@ -237,11 +237,11 @@ def _convert_str_to_handlertype(handler_str: str) -> tuple[HandlerType,
237237 converts "protobufstream(url:port)" to return both the HandlerType and the
238238 protobuf configuration
239239 """
240- # TODO/now Do not like this hardcoding of cases, try fixing
241- if "protobufstream" not in handler_str :
242- if "erstrace" in handler_str :
243- log . debug ( "ERSTrace is a C++ implementation, does not have an equivalent in Python" )
244- return None , None
240+ if "erstrace" in handler_str :
241+ log . debug ( "ERSTrace is a C++ implementation, does not have an equivalent in Python" )
242+ return None , None
243+
244+ if HandlerType . Protobufstream . value not in handler_str :
245245 return HandlerType .from_string (handler_str ), None
246246
247247 match = re .search (r"\(([^:]+):(\d+)\)" , handler_str )
0 commit comments