Skip to content

text.py

rerun.log.text

class LogLevel dataclass

Represents the standard log levels.

This is a collection of constants rather than an enum because we do support arbitrary strings as level (e.g. for user-defined levels).

CRITICAL: Final = 'CRITICAL' class-attribute

Designates catastrophic failures.

ERROR: Final = 'ERROR' class-attribute

Designates very serious errors.

WARN: Final = 'WARN' class-attribute

Designates hazardous situations.

INFO: Final = 'INFO' class-attribute

Designates useful information.

DEBUG: Final = 'DEBUG' class-attribute

Designates lower priority information.

TRACE: Final = 'TRACE' class-attribute

Designates very low priority, often extremely verbose, information.

class LoggingHandler(root_entity_path=None)

Bases: logging.Handler

Provides a logging handler that forwards all events to the Rerun SDK.

Because Rerun's data model doesn't match 1-to-1 with the different concepts from python's logging ecosystem, we need a way to map the latter to the former:

Mapping
  • Root Entity: Optional root entity to gather all the logs under.

  • Entity path: the name of the logger responsible for the creation of the LogRecord is used as the final entity path, appended after the Root Entity path.

  • Level: the log level is mapped as-is.

  • Body: the body of the text entry corresponds to the formatted output of the LogRecord using the standard formatter of the logging package, unless it has been overridden by the user.

Read more about logging handlers

def emit(record)

Emits a record to the Rerun SDK.

def log_text_entry(entity_path, text, *, level=LogLevel.INFO, color=None, ext=None, timeless=False)

Log a text entry, with optional level.

Parameters:

Name Type Description Default
entity_path str

The object path to log the text entry under.

required
text str

The text to log.

required
level Optional[str]

The level of the text entry (default: LogLevel.INFO). Note this can technically be an arbitrary string, but it's recommended to use one of the constants from LogLevel

LogLevel.INFO
color Optional[Sequence[int]]

Optional RGB or RGBA triplet in 0-255 sRGB.

None
ext Optional[Dict[str, Any]]

Optional dictionary of extension components. See rerun.log_extension_components

None
timeless bool

Whether the text entry should be timeless.

False