> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.conductorquantum.com/api-reference/stanza-api/jupyter/logs/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.conductorquantum.com/_mcp/server. # stanza.jupyter.logs Log streaming for Jupyter notebooks and servers. ## Module Contents ### Functions | Name | Description | |------|-------------| | [`_wait_for_log`](#stanzajupyterlogs_wait_for_log) | Wait for log file to exist or timeout. | | [`_print_tail`](#stanzajupyterlogs_print_tail) | Print last N lines from log file with proper terminal alignment. | | [`_stream_log`](#stanzajupyterlogs_stream_log) | Read and print new log lines with proper terminal alignment. | | [`follow`](#stanzajupyterlogsfollow) | Stream log file until Ctrl+C. | | [`attach`](#stanzajupyterlogsattach) | Stream log file with active kernel control. | ### API ```python stanza.jupyter.logs._wait_for_log( log_file: pathlib.Path, timeout: float = 30.0 ) -> None ``` Wait for log file to exist or timeout. Polls for the log file's existence, displaying a waiting message to stderr. Exits with status 1 if the file doesn't appear within the timeout period. **Parameters:** Path to the log file to wait for Maximum seconds to wait before exiting ```python stanza.jupyter.logs._print_tail( log_file: pathlib.Path, lines: int ) -> None ``` Print last N lines from log file with proper terminal alignment. **Parameters:** Path to the log file to read Number of lines to print from the end of the file ```python stanza.jupyter.logs._stream_log( f: object, poll_interval: float, log_file: pathlib.Path ) -> None ``` Read and print new log lines with proper terminal alignment. Strips carriage return artifacts from progress bars and formats output for proper terminal display. Exits if the log file is deleted. **Parameters:** Open file handle positioned at the current read position Seconds to sleep when no new data is available Path to the log file (for existence checking) ```python stanza.jupyter.logs.follow( log_file: pathlib.Path, lines: int = 10, poll_interval: float = 0.1 ) -> None ``` Stream log file until Ctrl+C. Displays the last N lines of the log file, then continuously streams new lines as they are written. Exits gracefully on Ctrl+C. **Parameters:** Path to the log file to follow Number of initial lines to display from the end of the file Seconds to wait between checks for new content ```python stanza.jupyter.logs.attach( log_file: pathlib.Path, kill_callback: collections.abc.Callable[[], None], lines: int = 10, poll_interval: float = 0.1 ) -> None ``` Stream log file with active kernel control. Displays the last N lines of the log file, then continuously streams new lines. Ctrl+C kills the kernel via the callback. ESC exits without killing (press twice for safety). **Parameters:** Path to the log file to follow Function to call when Ctrl+C is pressed Number of initial lines to display from the end of the file Seconds to wait between checks for new content