| 200 | return 0 |
| 201 | |
| 202 | def format(self, record: logging.LogRecord) -> str: |
| 203 | if "\n" in record.message: |
| 204 | if hasattr(record, "auto_indent"): |
| 205 | # Passed in from the "extra={}" kwarg on the call to logging.log(). |
| 206 | auto_indent = self._get_auto_indent(record.auto_indent) |
| 207 | else: |
| 208 | auto_indent = self._auto_indent |
| 209 | |
| 210 | if auto_indent: |
| 211 | lines = record.message.splitlines() |
| 212 | formatted = self._fmt % {**record.__dict__, "message": lines[0]} |
| 213 | |
| 214 | if auto_indent < 0: |
| 215 | indentation = _remove_ansi_escape_sequences(formatted).find( |
| 216 | lines[0] |
| 217 | ) |
| 218 | else: |
| 219 | # Optimizes logging by allowing a fixed indentation. |
| 220 | indentation = auto_indent |
| 221 | lines[0] = formatted |
| 222 | return ("\n" + " " * indentation).join(lines) |
| 223 | return self._fmt % record.__dict__ |
| 224 | |
| 225 | |
| 226 | def get_option_ini(config: Config, *names: str): |