The dpf_logger.py module#

Summary#

LoggerConfig

Configuration used when registering a DPF logger.

DPFLogger

Wrapper around a native DPF logger implementation pointer.

LogLevel

DPF logging levels.

LoggerSink

DPF logging sinks.

register_logger

Register and return a DPF logger instance.

get_logger

Get an existing DPF logger by name.

flush_all

Flush all currently registered DPF loggers.

Description#

High-level access to DPF framework logging APIs.

This module provides a Python wrapper around the native DPF logging APIs. It is designed for use in custom Python plugins, where code executes in-process with the DPF server and has direct access to native C-layer logging functions through the CAPI.

Note: This API is only available in custom Python plugins. Remote or client-side Python environments cannot access these logging functions.

Module detail#

dpf_logger.register_logger(name: str, config: LoggerConfig | None = None, server=None) DPFLogger#

Register and return a DPF logger instance.

Intended for use in custom Python plugins.

Parameters:
  • name (str) – Logger name to register.

  • config (LoggerConfig, optional) – Logger configuration (level, sinks). Default is Info level, stdout sink.

  • server (DPFServer, optional) – DPF server instance. If None, uses global server.

Returns:

Logger wrapper bound to native DPF logger implementation.

Return type:

DPFLogger

Raises:

ServerTypeError – If called outside a custom Python plugin context or from a remote client.

dpf_logger.get_logger(name: str, server=None) DPFLogger#

Get an existing DPF logger by name.

Intended for use in custom Python plugins.

Parameters:
  • name (str) – Logger name to retrieve.

  • server (DPFServer, optional) – DPF server instance. If None, uses global server.

Returns:

Logger wrapper bound to native DPF logger implementation.

Return type:

DPFLogger

Raises:

ServerTypeError – If called outside a custom Python plugin context or from a remote client.

dpf_logger.flush_all(server=None) None#

Flush all currently registered DPF loggers.

Intended for use in custom Python plugins.

Parameters:

server (DPFServer, optional) – DPF server instance. If None, uses global server.

Raises:

ServerTypeError – If called outside a custom Python plugin context or from a remote client.