File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 22import os
33from enum import StrEnum
44from logging import LogRecord
5- from typing import TYPE_CHECKING
5+ from typing import TYPE_CHECKING , Any
66
77from prompt_toolkit .patch_stdout import StdoutProxy
88from pygelf import GelfUdpHandler
@@ -79,7 +79,8 @@ def format_record(record) -> str:
7979 sep = "<white>,</white> "
8080 if "extra" in record :
8181 extras = [
82- format_key_value (k , v )
82+ # Escape `<` so Loguru doesn't parse them as format tags
83+ format_key_value (k , f"{ v } " .replace ("<" , r"\<" ))
8384 for k , v in record ["extra" ].items ()
8485 if not k .startswith ("_" )
8586 ]
@@ -99,7 +100,7 @@ def format_record(record) -> str:
99100 """
100101
101102
102- def format_key_value (k , v ) :
103+ def format_key_value (k : Any , v : Any ) -> str :
103104 return f"<cyan>{ k } </cyan><white>=</white><magenta>{ v } </magenta>"
104105
105106
You can’t perform that action at this time.
0 commit comments