Log
log
¶
Centralised logging configuration shared by the server, launcher CLI, GUI, and Modal jobs
One Setup
-
setup_loggingconfigures themirumojilogger with a rotating file handler and / or aRichconsole handler -
The file format is clean and structured for later reading, while the console renders through
Rich -
The console handler coordinates with
tqdmso the live progress bars rendered by file transfers / transcription are never broken by a log line
MIRUMOJI_LOGGING_THEME = Theme({'accent': '#E2533B', 'accent.soft': '#F08A6E', 'info': '#5E83A4', 'success': '#8AA06A', 'danger': 'bold #C8503D', 'warning': '#D9A441', 'muted': '#7E7567', 'heading': 'bold #F4EEE3', 'ink': '#F4EEE3', 'highlighter.ok': '#8AA06A', 'highlighter.bad': 'bold #C8503D', 'highlighter.warn': '#D9A441', 'highlighter.number': '#C99A57', 'highlighter.uuid': '#F08A6E', 'highlighter.path': '#5E83A4', 'highlighter.url': 'underline #5E83A4', 'highlighter.module': '#7E7567'})
module-attribute
¶
Defines the Rich theme for mirumoji's console logging messages mimicking the
frontend's Sumi & Shu design
MirumojiHighlighter
¶
Bases: RegexHighlighter
Custom Rich highlighter for mirumoji's console logging messages
setup_logging(*, log_file='backend.log', console=True, level=None, capture_root=False)
¶
Configures the mirumoji logger with shared handlers and formatters
Handlers
-
A
RotatingFileHandler(5 MB x 3 backups) underHOST_LOG_PATH, using a clean structured format, whenlog_fileis given -
A
tqdm-awareRichconsole handler whenconsoleisTrue
Idempotent
On each call, only the handlers attached by this module are cleared so that repeated calls never stack handlers or disturb third-party ones
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
log_file
|
str | None
|
Log file name under |
'backend.log'
|
console
|
bool
|
Whether to attach the |
True
|
level
|
str | int | None
|
Explicit level, or |
None
|
capture_root
|
bool
|
When |
False
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |