Skip to main content

Module logging

Module logging 

Source
Expand description

The log file, and keeping stray stderr off the screen.

Anything written to stderr while the TUI owns the terminal is drawn over it, and Polars, its verbose mode and C libraries all write there. So while the TUI runs, fd 2 points at the log file, Polars warnings are routed through the log facade, and errors that are not worth stopping for (cache, history) land here instead of vanishing.

Structs§

FileLog
A size-capped log file with one rotation.
LogSettings
Where the log goes and how much of it.
TuiSession
The span during which the TUI owns the terminal: stderr goes to the log (Unix), and a panic on a background thread is logged instead of printed over the screen. Dropping it, on every exit path, hands stderr back.

Enums§

LevelFilter
An enum representing the available verbosity level filters of the logger.

Constants§

LOG_FILE_NAME
The log’s name in the cache directory.

Traits§

LogFailure
Log a failure not worth stopping for (cache, history) instead of dropping it.

Functions§

catch_panic
Run work, turning a panic into a message for the user. The hook has already logged the panic with its backtrace; the message says where. A panic on a Polars thread that this work was waiting on is resumed here, so it is reported here too.
current_path
The file the log is writing to, if it is open.
init
Open the log and install the logger and the Polars warning hook. Safe to call again (the Python binding runs the TUI once per view); the latest settings win.
keep_out_of_log
Never write secret to the log as it is.
next_polars_warning
The next Polars user warning not yet shown, for the control bar.
redact
Mask credentials in a log line: known secret values, the user and password in a URL, signed-URL and SAS query parameters, and authorization headers.
rotated_path
The rotated copy of path: datui.log → datui.log.1.
take_unreported_panic
What to flash when a background thread panicked with nothing to say so: a raw thread’s result simply never arrives. None when none did since the last call.