Formatter for file logging that removes ANSI escape codes.
| 25 | |
| 26 | |
| 27 | class AgentOpsLogFileFormatter(logging.Formatter): |
| 28 | """Formatter for file logging that removes ANSI escape codes.""" |
| 29 | |
| 30 | ANSI_ESCAPE_PATTERN = re.compile(r"\x1b\[[0-9;]*m") |
| 31 | |
| 32 | def format(self, record): |
| 33 | record.msg = self.ANSI_ESCAPE_PATTERN.sub("", str(record.msg)) |
| 34 | return super().format(record) |
no outgoing calls
no test coverage detected
searching dependent graphs…