Skip to main content

Yukilog

Yukilog is the logging boundary shared by Liteyuki applications. It keeps application code independent from Loguru's sink configuration API while retaining a deliberately isolated compatibility escape hatch for legacy integrations.

Yukilog requires Python 3.14 or newer. Loguru is its only runtime dependency.

Usage

Importing Yukilog does not add, remove, or reconfigure any sink. The application entry point owns configuration:

from yukilog import FileSink, LoggingConfig, configure, get_logger, shutdown

configure(
    LoggingConfig(
        files=(FileSink("logs/app.log", rotation="10 MB", retention="7 days"),),
    )
)

log = get_logger(component="api", runtime="main")
log.info("Listening on {address}", address="127.0.0.1:8000")

with log.contextualize(event_id="evt-42"):
    log.debug("Dispatching event")

shutdown()

configure() with no arguments installs one colored, human-readable stderr sink. Repeated calls with an equal configuration are no-ops. A different configuration replaces sinks previously installed by Yukilog. By default the first call also removes existing Loguru sinks because configuration is an application-level operation; set remove_existing=False when embedding Yukilog in another host.

Every facade logger carries the stable context fields component, plugin, runtime, event_id, and bot_id. Values not known at bind time are null in structured output. Arbitrary additional fields are retained under extra.

Structured output

Use a JSON Lines sink for machine consumers:

from yukilog import JsonSink, LoggingConfig, configure

configure(LoggingConfig(console=None, json=JsonSink()))

Supervised child runtimes use the dedicated marker and stdout-only configuration:

from yukilog import configure_child_runtime

configure_child_runtime(level="DEBUG")

Each emitted line contains "_yukilog":"yukilog.child.v1". The schema marker is part of Yukilog's public protocol; Loguru's private serialized record shape is not.

Standard library logging

intercept_stdlib_logging() replaces handlers on the root standard-library logger and routes propagating records through Yukilog. It is idempotent. shutdown() (or restore_stdlib_logging()) restores the root handlers and level captured at the first interception. Named loggers with propagate=False remain application-owned.

Legacy Loguru compatibility

New code should use yukilog.Logger. Code that genuinely requires Loguru-only methods such as opt() must import the escape hatch explicitly:

from yukilog.compat import get_loguru_logger

legacy_logger = get_loguru_logger(plugin="legacy.example")
legacy_logger.opt(colors=True).info("<green>Loaded</green>")

The returned object is Loguru-compatible and therefore is not covered by the stable facade contract. Sink ownership remains with the application entry point.

Development

uv sync
uv run ruff check .
uv run mypy
uv run pytest
uv build

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yukilog-1.0.0.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yukilog-1.0.0-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file yukilog-1.0.0.tar.gz.

File metadata

  • Download URL: yukilog-1.0.0.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for yukilog-1.0.0.tar.gz
Algorithm Hash digest
SHA256 2462b7074c03a08660e6b82ae10fc60122df4f12883f7fe125ecefac9eb6f8b1
MD5 5e54e8e5352ba04f057711cabce4dc2f
BLAKE2b-256 9d409bef35f0d167e38bc89467bd0caa40439e4643613a7c868e90f4d19b8770

See more details on using hashes here.

File details

Details for the file yukilog-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: yukilog-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 10.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for yukilog-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8e5fac4f6b57078b6f357fe2f0116b8d11a13caf2867708d80a7e1a0bd93bc5b
MD5 66a201aca417482989d5fe47e79e6ac6
BLAKE2b-256 e8979a5e0bf3215778c0767922aeebe1736bd8f81c2d82e75309d8c686f92f23

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 files

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