Skip to main content

x_logger

English 日本語

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.3

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.3
File Size Uploaded Provenance
xlogger_py-0.3.3.tar.gz 16.4 kB With provenance Details

Built distribution (wheel)

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

Total release size: 29.9 kB

Release files / xlogger_py-0.3.3.tar.gz

Download URL xlogger_py-0.3.3.tar.gz
Size 16.4 kB
Tags Source
SHA-256 checksum
How to use checksums
d9c99ae789f1363517663471bb3fe4b071aa4624e455174b6885be22235abead
BLAKE2b-256 checksum
How to use checksums
c06267ea374a59172f93e171e2d4db0854881cf345b15cdcc8638246462aa28c
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.3-py3-none-any.whl

Download URL xlogger_py-0.3.3-py3-none-any.whl
Size 13.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9474b0ed8a48cb67a0765486b053e2f702301e6565dee116b8acf1fa71601ed1
BLAKE2b-256 checksum
How to use checksums
7d369c905a41a1bf3b0b20ddc1b75f9773a1f3c0f7e4c286f418ff588ce3ba83
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.3

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.3.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