Skip to main content

alogging

alogging is a Python library that provides asynchronous logging capabilities. It is designed to work with the standard Python logging module, but adds asynchronous functionality to improve performance in applications that make heavy use of logging.

Features

  • Asynchronous logging: Log messages are processed in a separate process to avoid blocking the main application.
  • Compatibility: Works with the standard Python logging module, so you can use all the features and handlers you're familiar with.
  • Flexibility: Provides a variety of handlers, including RotatingFileHandler, HTTPHandler, SMTPHandler, SysLogHandler, and more.

Usage

To use alogging, you first need to start the backend process. This can be done using the start_backend method:

import asyncio
import alogging

asyncio.run(alogging.start_backend())

You can then get a logger and use it just like you would with the standard logging module:

log = alogging.getLogger("my_logger")
log.info("This is an info message")

You can also configure the logger using the basicConfig function:

alogging.basicConfig(
    filename="test.log",
    level=alogging.DEBUG,
    format="%(name)s - %(levelname)s - %(message)s",
)

Handlers

alogging provides a variety of handlers that you can use to control where your log messages go. These include:

  • RotatingFileHandler: Writes log messages to a file, with support for automatic rotation when the file reaches a certain size.
  • HTTPHandler: Sends log messages to a web server as HTTP POST requests.
  • SMTPHandler: Sends log messages to an email address using SMTP.
  • SysLogHandler: Sends log messages to a Unix syslog daemon.

To use a handler, you need to create an instance of it and add it to your logger:

handler = alogging.handlers.RotatingFileHandler("test.log", maxBytes=10000, backupCount=5)
log.addHandler(handler)

Installation

You can install alogging using pip:

pip install py-extensions-alogging

Or add it using poetry:

poetry add py-extensions-alogging

Contributing

Contributions to alogging are welcome. Please submit a pull request or create an issue on GitHub.

License

alogging is licensed under the MIT License. See LICENSE for more information.

Metadata

Release files for py-extensions-alogging 0.1.1

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

Source distribution (sdist)

Source distribution for py-extensions-alogging 0.1.1
File Size Uploaded
py_extensions_alogging-0.1.1.tar.gz 5.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for py-extensions-alogging 0.1.1
File Interpreter ABI Platform
py_extensions_alogging-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 12.8 kB

Release files / py_extensions_alogging-0.1.1.tar.gz

Download URL py_extensions_alogging-0.1.1.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e705a8aeeeba0177aa3eef2b8f45e762b3d9ad139085d088841762542e32c078
BLAKE2b-256 checksum
How to use checksums
7fe783c05429a60d54cc5f2034f317086034393197034f9b5ddffef7cbc7eb97
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.11.1 Darwin/23.3.0

Release files / py_extensions_alogging-0.1.1-py3-none-any.whl

Download URL py_extensions_alogging-0.1.1-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6f3945e8dd2d9a70f206ac8ec22c0186891ec7d2a7aa7c637d8fccf081c7f877
BLAKE2b-256 checksum
How to use checksums
4692a39f03f224591c06f054f9de85d9e0528ce991f5fce88bb9d50e376eaa6c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.11.1 Darwin/23.3.0

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release 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