| 174 | return 0 |
| 175 | |
| 176 | def format(self, record: logging.LogRecord) -> str: |
| 177 | if "\n" in record.message: |
| 178 | if hasattr(record, "auto_indent"): |
| 179 | # Passed in from the "extra={}" kwarg on the call to logging.log(). |
| 180 | auto_indent = self._get_auto_indent(record.auto_indent) # type: ignore[attr-defined] |
| 181 | else: |
| 182 | auto_indent = self._auto_indent |
| 183 | |
| 184 | if auto_indent: |
| 185 | lines = record.message.splitlines() |
| 186 | formatted = self._fmt % {**record.__dict__, "message": lines[0]} |
| 187 | |
| 188 | if auto_indent < 0: |
| 189 | indentation = _remove_ansi_escape_sequences(formatted).find( |
| 190 | lines[0] |
| 191 | ) |
| 192 | else: |
| 193 | # Optimizes logging by allowing a fixed indentation. |
| 194 | indentation = auto_indent |
| 195 | lines[0] = formatted |
| 196 | return ("\n" + " " * indentation).join(lines) |
| 197 | return self._fmt % record.__dict__ |
| 198 | |
| 199 | |
| 200 | def get_option_ini(config: Config, *names: str): |