| 195 | |
| 196 | @classmethod |
| 197 | def _setup_loguru(cls) -> None: |
| 198 | if cls._configured: |
| 199 | return |
| 200 | |
| 201 | _loguru.remove() |
| 202 | cls._console_sink_id = _loguru.add( |
| 203 | sys.stdout, |
| 204 | level="DEBUG", |
| 205 | colorize=True, |
| 206 | filter=lambda record: not record["extra"].get("is_trace", False), |
| 207 | format=( |
| 208 | "<green>[{time:HH:mm:ss.SSS}]</green> {extra[plugin_tag]} " |
| 209 | "<level>[{extra[short_levelname]}]</level>{extra[astrbot_version_tag]} " |
| 210 | "[{extra[source_file]}:{extra[source_line]}]: <level>{message}</level>" |
| 211 | ), |
| 212 | ) |
| 213 | cls._configured = True |
| 214 | |
| 215 | @classmethod |
| 216 | def _setup_root_bridge(cls) -> None: |