Skip to main content

x_logger

Origin of the name

The x_logger package consolidates common functionality from project-specific loggers, such as the logger for daruma and el_logger for elves, and reconstructs it as a general-purpose logger without restricting its intended use.

The x denotes an arbitrary or general-purpose application. Another simple reason for the name is that no better name came to mind.

Introduction

x_logger is a logger built on Python's standard logging module. It uses logger_name as the identifier of a logical logger and makes it easy to configure console output, file output, and TimedRotatingFileHandler.

The same logger_name refers to the same named logger; different logger_name values identify different loggers.

For devices, the basic convention is to use the device class name as logger_name. This makes it possible to use the same logical logger name consistently for log storage, multiprocessing, and a future log-viewing server.

Single-process logger

Normally, use XLogger.

from x_logger.x_logger import XLogger

logger = XLogger(
    logger_name="Cobotta",
    log_mode="rotating",
    log_name="Cobotta.log",
)

logger.info("started")

An XLogger instance can also be passed to other classes. However, the logical identity of the logger is its logger_name, not the instance itself.

log_mode

default outputs to the console only.

file outputs to both the specified file and the console. It can be used for standalone file logging and does not require a device server or log-viewing server.

rotating or rotate outputs to both a TimedRotatingFileHandler and the console. Rotation occurs at midnight, and the number of retained backups is specified by backup_count.

Handler management

Handlers created by XLogger are tagged with identification information for XLogger management. When XLogger reconfigures the same logger_name, it closes the previous XLogger-managed handlers before replacing them with the new configuration.

This prevents console or file handlers from accumulating when XLogger is recreated.

Named loggers use propagate = False, preventing XLogger output from passing through the root logger and appearing on the console again.

The root logger's coloredlogs configuration is performed only once per process.

Multiprocessing logger

For multiprocessing, use the separate MultiProcessXLogger class. It shares the same concepts of output modes, logger names, levels, and formats as the single-process XLogger.

from x_logger.multiprocess import MultiProcessXLogger

logger = MultiProcessXLogger(
    logger_name="Cobotta",
    log_mode="rotating",
    log_name="Cobotta.log",
)

In multiprocessing, each process does not own a file handler. Instead, each process sends LogRecord objects through a QueueHandler to the owner process. Only the owner's QueueListener owns console, file, and rotating handlers.

parent process ---\
child process 1 ---+--> Queue --> QueueListener --> console
child process 2 ---/                         |
                                             +--> file / rotating file

This keeps file output and rotation under a single owner for each logical logger.

With fork, file handlers inherited by the child process are closed and logging is switched to QueueHandler. With spawn, QueueHandler is configured on the restored logger.

Multiprocessing operations, the Queue, QueueListener, process identification, and shutdown are separated into multiprocess.py.

Logical loggers and log viewing

In device systems, the device class name is generally used as logger_name.

Cobotta
  -> logger_name: Cobotta
  -> log storage: <prefix>/Cobotta/...

Camera
  -> logger_name: Camera
  -> log storage: <prefix>/Camera/...

A future log-viewing server is envisioned to expose current and rotated logs over gRPC or similar protocols, using this logical logger name as its reference.

XLogger is responsible for creating and storing logs, while the log-viewing server is responsible for exposing the stored logical log streams.

Metadata

Release files for xlogger-py 0.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xlogger-py 0.3.2
File Size Uploaded Provenance
xlogger_py-0.3.2.tar.gz 16.2 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for xlogger-py 0.3.2
File Interpreter ABI Platform
xlogger_py-0.3.2-py3-none-any.whl Python 3 none any Details

Total release size: 29.5 kB

Release files / xlogger_py-0.3.2.tar.gz

Download URL xlogger_py-0.3.2.tar.gz
Size 16.2 kB
Tags Source
SHA-256 checksum
How to use checksums
20753aea84dd92e82c85c4af14216559b52da5f8c5664ff58cbf16da9ce7b0c8
BLAKE2b-256 checksum
How to use checksums
18199badffd3bb1e5fe757b4677eb81f6f04ee1e4ae4a7d565acba29fed86630
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.

Transparency log

Release files / xlogger_py-0.3.2-py3-none-any.whl

Download URL xlogger_py-0.3.2-py3-none-any.whl
Size 13.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f1472377e9f390d09a7b30719bdce4634afb4bcfed6641615bd8559d4faa77f5
BLAKE2b-256 checksum
How to use checksums
a02875e029635b77af163e768712863dbcee6d56359030917b9f9e3ac2309ef1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.

Transparency log

Security for xlogger-py 0.3.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for xlogger_py-0.3.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page