Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Eventual Inc Daft Setup Logger

From Leeroopedia


Knowledge Sources
Domains Logging, Observability
Last Updated 2026-02-08 14:00 GMT

Overview

Concrete tool for configuring unified Python and Rust logging levels with optional prefix filtering for the Daft framework.

Description

The setup_logger function configures the Python `logging` module and synchronizes the log level with the Rust engine via `daft.refresh_logger()`. It supports level selection (`DEBUG`, `INFO`, `WARNING`, `ERROR`), prefix-based exclusion filters, a `daft_only` mode that restricts logs to the Daft namespace, and customizable log format strings. A deprecated `setup_debug_logger` function is provided for backward compatibility.

Usage

Call `setup_logger` at the start of a script or notebook to enable verbose logging for debugging Daft operations. Use `daft_only=True` to suppress logs from other libraries like PyArrow or fsspec.

Code Reference

Source Location

Signature

def setup_logger(
    level: str = "debug",
    exclude_prefix: typing.Iterable[str] | None = None,
    daft_only: bool = False,
    logformat: str = "%(asctime)s - %(name)s - %(levelname)s - %(message)s",
    datefmt: str = "%Y-%m-%d %H:%M:%S.%s",
) -> None:
    """Setup Daft logger with a specific log level, optional prefix filtering, and Rust sync.

    Args:
        level: Log level (DEBUG, INFO, WARNING, ERROR).
        exclude_prefix: Prefixes to exclude from logging.
        daft_only: Only log Daft module messages.
        logformat: Python logging format string.
        datefmt: Date format string.

    Raises:
        ValueError: If the log level is not valid.
    """

Import

from daft.logging import setup_logger

I/O Contract

Inputs

Name Type Required Description
level str No Log level: DEBUG, INFO, WARNING, ERROR (default: "debug")
exclude_prefix Iterable[str] or None No Logger name prefixes to exclude
daft_only bool No If True, only show logs from "daft.*" loggers
logformat str No Python logging format string
datefmt str No Date format string

Outputs

Name Type Description
(none) None Configures global Python logging and syncs Rust log level as a side effect

Usage Examples

Basic Debug Logging

from daft.logging import setup_logger

# Enable debug logging for all modules
setup_logger("debug")

import daft
df = daft.read_parquet("data.parquet")
df.collect()  # Debug logs will show query plan details

Daft-Only Logging

from daft.logging import setup_logger

# Only show Daft logs, suppress PyArrow/fsspec noise
setup_logger("info", daft_only=True)

Semantic Links

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment