Skip to content

Releases: m6mok/aiologging

aiologging 0.2.0

Choose a tag to compare

@m6mok m6mok released this 09 Jul 07:54

Breaking release: the logging pipeline is now queue-based and the API strictly follows the standard logging module.

Highlights

  • Background consumer: records are created at the call site and enqueued; a background task performs handler I/O, so await logger.info(...) never waits for a file write or an HTTP request.
  • Configurable delivery: delivery="enqueue" (default, resolves on enqueue) or "await" (resolves after handlers processed the record) — via basicConfig or per logger.
  • Configurable backpressure: bounded queue with overflow="block" (default, no records lost), "drop_new" or "drop_old".
  • Stdlib bridge: captureStdlib() / basicConfig(capture_stdlib=True) routes third-party (standard logging) records through the same async handlers — thread-safe, with pre-loop buffering and feedback-loop protection.
  • Lifecycle: lazy consumer start, await aiologging.flush(), await aiologging.shutdown(), transparent event-loop change recovery (queued and in-flight records are rescued).
  • API parity with logging.Logger: getEffectiveLevel, getChild/getChildren, hasHandlers, makeRecord, findCaller with stacklevel, parent/propagate/filters attributes, module-level convenience coroutines, disable(level), getLogger() returning the root logger.

Breaking changes

  • Removed Logger.setFormatter/getFormatter (formatters live on handlers), getLevel (use getEffectiveLevel), disable()/enable() methods (use the disabled attribute or aiologging.disable), setParent/getParent, getRootLogger, getLoggerContext, log_async.
  • async with logger: now flushes the queue instead of closing the shared logger instance; call await aiologging.shutdown() once at application exit.
  • await logger.info(...) returns once the record is enqueued (configurable), not after handler I/O.

Fixes

  • Handlers can be constructed outside a running event loop on Python 3.9 (lazy asyncio.Lock creation).
  • A record being dispatched when the event loop is torn down is no longer lost.

Tested on Python 3.9–3.14 (pytest + mypy strict).

v0.1.1

Choose a tag to compare

@m6mok m6mok released this 09 Jul 06:52

What's Changed

  • Python 3.13 and 3.14 support (added to CI matrix and PyPI classifiers)
  • Replaced deprecated asyncio.iscoroutinefunction (removal slated for Python 3.16) with inspect.iscoroutinefunction
  • Removed dead Python 3.8 compatibility branches in aiologging/types.py

Full Changelog: v0.1.0...v0.1.1

aiologging 0.1.0

Choose a tag to compare

@m6mok m6mok released this 09 Jul 06:38

First release of aiologging — an asynchronous logging library for Python 3.9+ with an API mirroring the standard logging module (await logger.info(...)).

Features

  • Full standard-logging-style API: levels, filters, formatters, logger hierarchy with propagation
  • Async handlers: streams, files, size- and time-based rotation (aiofiles), HTTP with batching and pluggable authentication (aiohttp), JSON/text/protobuf formats
  • Buffered handlers with adaptive batching and retries
  • Built-in performance metrics, rate limiting, custom error handlers
  • Configuration from dictionaries, JSON files, or environment variables
  • Optional dependencies — install only what you need: pip install aiologging[aiofiles], [aiohttp], [protobuf], [all]
  • Fully typed, strict mypy, py.typed

Notable fixes landed for this release

  • exc_info=True is normalized like in standard logging, so formatters render tracebacks
  • Correct dispatch of sync streams (StringIO, files) vs real asyncio.StreamWriter
  • Closing a stream handler no longer closes sys.stdout/sys.stderr
  • Removed incorrect id(record)-keyed caches
  • Logging through a child of a closed parent logger no longer raises

See examples/ for runnable examples.