Skip to main content

logry

Python logging library with native async support, multiple independent loggers, and zero external dependencies.

Installation

pip install logry

Requires Python 3.8 or higher.


Quick Start

from logry import log

log.info("Server started")
log.success("Connected to database")
log.warning("Memory usage at 80%")
log.error("Connection dropped")
log.debug("user_id=123")

Output:

[2026-03-09 10:23:45] INFO    | Server started
[2026-03-09 10:23:46] SUCCESS | Connected to database
[2026-03-09 10:23:47] WARNING | Memory usage at 80%
[2026-03-09 10:23:48] ERROR   | Connection dropped
[2026-03-09 10:23:49] DEBUG   | user_id=123

Log Levels

Level Method Color
DEBUG log.debug() Grey
INFO log.info() Blue
SUCCESS log.success() Green
WARNING log.warning() Yellow
ERROR log.error() Red

Usage

Global logger

The simplest way to use logry is via the built-in global log instance, which is ready to use immediately after import.

from logry import log

log.info("Application initialized")
log.error("Unexpected error")

Named loggers

Each Logger instance is fully independent and can be configured separately.

from logry import Logger

db  = Logger("database")
api = Logger("api")
bot = Logger("bot")

db.info("Connected to PostgreSQL")
api.error("Request timeout")
bot.success("Polling started")

Output formats

Three formats are available: pretty (default), minimal, and json.

pretty outputs colored lines with a timestamp, suited for development. minimal outputs level and message only. json outputs structured single-line JSON, suited for production log collection.

log = Logger("app", format="json")
log.info("Structured output")
{"time": "2026-03-09 10:23:45", "level": "INFO", "name": "app", "message": "Structured output"}

File output

log = Logger("app")
log.set_file("app.log")

With automatic rotation:

log.set_file("app.log", max_size="10MB", backup=3)

max_size accepts values in KB or MB. When the file reaches the specified size, it is rotated and up to backup copies are retained.

Custom colors

log.set_colors({
    "debug":   "cyan",
    "info":    "blue",
    "success": "green",
    "warning": "yellow",
    "error":   "red",
})

Available colors: black, red, green, yellow, blue, magenta, cyan, white, grey.

Full configuration

All options can be set at construction time or updated at runtime.

log = Logger(
    name="app",
    level="DEBUG",
    save="app.log",
    format="pretty",
    colors=True,
    async_mode=False,
)

log.set_level("WARNING")
log.set_format("json")
log.set_file("app.log", max_size="5MB", backup=5)

Async support

When async_mode=True, log calls become coroutines and must be awaited. Output is written through an asyncio.Queue worker, keeping the event loop unblocked.

import asyncio
from logry import Logger

log = Logger("app", async_mode=True)

async def main():
    await log.ainfo("Async log entry")
    await log.aerror("Async error")

asyncio.run(main())

Benchmarks

Tested on Python 3.12 with 100,000 filtered log entries. Filtered means the log level of the call is below the logger's active level, so no output is produced — the most common scenario in production.

Library Time Messages/sec
stdlib logging 0.085s 1,176,000
logry 0.031s 3,225,000

logry avoids formatting the message string entirely when the log level is inactive (lazy formatting), which accounts for the difference.


License

MIT © riokzy

Metadata

Release files for logry 0.1.0

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

Source distribution (sdist)

Source distribution for logry 0.1.0
File Size Uploaded
logry-0.1.0.tar.gz 9.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for logry 0.1.0
File Interpreter ABI Platform
logry-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 20.8 kB

Release files / logry-0.1.0.tar.gz

Download URL logry-0.1.0.tar.gz
Size 9.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a02b592dd280e91dd3b1aa206670c3380d36dbaf583df1f1686bb680c5057015
BLAKE2b-256 checksum
How to use checksums
a0f67b184eb803b1808b1bcb731dc0da3d5da997432378c70a7732985eff8757
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.12.1.2 readme-renderer/34.0 requests/2.32.5 requests-toolbelt/1.0.0 urllib3/2.6.3 tqdm/4.67.3 importlib-metadata/8.7.1 keyring/25.7.0 rfc3986/2.0.0 colorama/0.4.6 CPython/3.13.12

Release files / logry-0.1.0-py3-none-any.whl

Download URL logry-0.1.0-py3-none-any.whl
Size 10.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4d2f94fa120fe1c4a68921d981704acbf493da169e89be554bafc69ebb45fa41
BLAKE2b-256 checksum
How to use checksums
a503570ef0aae7444bec595e13b96818932221b4036ff940df09933ef3fb5eed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.12.1.2 readme-renderer/34.0 requests/2.32.5 requests-toolbelt/1.0.0 urllib3/2.6.3 tqdm/4.67.3 importlib-metadata/8.7.1 keyring/25.7.0 rfc3986/2.0.0 colorama/0.4.6 CPython/3.13.12

Release history Release notifications | RSS feed

This release

0.1.0 This release

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