esc
Start typing to search the docs
Navigate Open

Show and filter text logs

Log text messages

Log a TextLog with an optional level:

rr.log("log/status", rr.TextLog("Application started.", level=rr.TextLogLevel.INFO))

The built-in levels are TRACE, DEBUG, INFO, WARN, ERROR, and CRITICAL. You can also pass any other string as the level.

To forward Python logging to Rerun, add rr.LoggingHandler:

import logging

logging.getLogger().addHandler(rr.LoggingHandler("logs"))
logging.getLogger().setLevel(logging.DEBUG)

Configure the text log view

The TextLogView shows the messages as a table. In the blueprint, you can choose:

  • columns=rrb.TextLogColumns(…):
    • timeline_columns: which timelines to show as columns. By default, only the active timeline.
    • text_log_columns: which of the built-in columns to show, and in which order: "loglevel", "entitypath", and "body".
  • rows=rrb.TextLogRows(filter_by_log_level=[…]): which log levels to show. By default, all of them.
  • format_options=rrb.TextLogFormat(monospace_body=True): show the message in a monospace font.
"""Use a blueprint to show a text log."""

import rerun as rr
import rerun.blueprint as rrb

rr.init("rerun_example_text_log", spawn=True)

rr.set_time("time", sequence=0)
rr.log(
    "log/status", rr.TextLog("Application started.", level=rr.TextLogLevel.INFO)
)
rr.set_time("time", sequence=5)
rr.log("log/other", rr.TextLog("A warning.", level=rr.TextLogLevel.WARN))
for i in range(10):
    rr.set_time("time", sequence=i)
    rr.log(
        "log/status",
        rr.TextLog(f"Processing item {i}.", level=rr.TextLogLevel.INFO),
    )

# Create a text view that displays all logs.
blueprint = rrb.Blueprint(
    rrb.TextLogView(
        origin="/log",
        name="Text Logs",
        columns=rrb.TextLogColumns(
            timeline_columns=["time"],
            text_log_columns=["loglevel", "entitypath", "body"],
        ),
        rows=rrb.TextLogRows(
            filter_by_log_level=["INFO", "WARN", "ERROR"],
        ),
        format_options=rrb.TextLogFormat(
            monospace_body=False,
        ),
    ),
    collapse_panels=True,
)

rr.send_blueprint(blueprint)

You can change the same settings in the Viewer: select the view and use the selection panel.

Limitations

  • You cannot add your own columns (for example, a thread name or a source file). As a workaround, put that information into the message text, or log it to a separate entity path, which shows up in the entitypath column.
  • There is no text search or filtering by message content. To show only some messages, split them into different entity paths, and use the view's entity query to choose which ones to show.

See missing features.