Metadata-Version: 2.2
Name: spydlog
Version: 1.0.1
Summary: Python bindings for spdlog
Author-Email: Romain Augier <contact@romainaugier.com>
License: MIT
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# spydlog

Python bindings for [spdlog](https://github.com/gabime/spdlog) using [nanobind](https://github.com/wjakob/nanobind).

[![CI](https://github.com/romainaugier/spydlog/workflows/CI/badge.svg)](https://github.com/romainaugier/spydlog/actions/workflows/ci.yml)
[![codecov](https://codecov.io/gh/romainaugier/spydlog/branch/main/graph/badge.svg)](https://codecov.io/gh/romainaugier/spydlog)

[![3.9](https://github.com/romainaugier/spydlog/actions/workflows/ci.yml/badge.svg?event=push&python-version=3.9&label=3.9)](https://github.com/romainaugier/spydlog/actions/workflows/ci.yml)
[![3.10](https://github.com/romainaugier/spydlog/actions/workflows/ci.yml/badge.svg?event=push&python-version=3.10&label=3.10)](https://github.com/romainaugier/spydlog/actions/workflows/ci.yml)
[![3.11](https://github.com/romainaugier/spydlog/actions/workflows/ci.yml/badge.svg?event=push&python-version=3.11&label=3.11)](https://github.com/romainaugier/spydlog/actions/workflows/ci.yml)
[![3.12](https://github.com/romainaugier/spydlog/actions/workflows/ci.yml/badge.svg?event=push&python-version=3.12&label=3.12)](https://github.com/romainaugier/spydlog/actions/workflows/ci.yml)
[![3.13](https://github.com/romainaugier/spydlog/actions/workflows/ci.yml/badge.svg?event=push&python-version=3.13&label=3.13)](https://github.com/romainaugier/spydlog/actions/workflows/ci.yml)
[![3.14](https://github.com/romainaugier/spydlog/actions/workflows/ci.yml/badge.svg?event=push&python-version=3.14&label=3.14)](https://github.com/romainaugier/spydlog/actions/workflows/ci.yml)

[![Linux](https://img.shields.io/badge/platform-Linux-blue.svg)](https://github.com/romainaugier/spydlog/actions/workflows/ci.yml)
[![macOS](https://img.shields.io/badge/platform-macOS-blue.svg)](https://github.com/romainaugier/spydlog/actions/workflows/ci.yml)
[![Windows](https://img.shields.io/badge/platform-Windows-blue.svg)](https://github.com/romainaugier/spydlog/actions/workflows/ci.yml)

## Installation

Supported Python versions ranges from 3.9 (minimum version) up to the latest (3.14). Supported platforms are Windows, Linux and MacOs.

```bash
pip install spydlog
```

## Documentation

Please refer to the official documentation of [spdlog](https://github.com/gabime/spdlog/wiki) and see the [documentation](https://github.com/romainaugier/spydlog/blob/main/DOCUMENTATION.md) for examples.

## Performance

A benchmark against the native logger module is avaiable in benchmarks. The results are great, but some improvements can be made to the bindings (for console-logging especially).

| Library | Scenario | Messages/Second | Speedup vs Python |
|---------|----------|-----------------|-------------------|
| Python  | Console         |         5,093 |              1.0x |
| Python  | File            |        37,270 |              1.0x |
| Python  | Disabled        |     6,583,365 |              1.0x |
| spydlog | Console (MT)    |        13,651 |              2.7x |
| spydlog | Console (ST)    |        13,388 |              2.6x |
| spydlog | File (MT)       |     1,302,138 |             34.9x |
| spydlog | File (ST)       |     1,390,776 |             37.3x |
| spydlog | Async File      |     2,305,422 |             61.9x |
| spydlog | Disabled        |     3,955,180 |              0.6x |

## License and attribution

All material in this repository is licensed under an [MIT License](https://github.com/romainaugier/spydlog/blob/main/LICENSE).

## Acknowledgement

Some code and text of this repository has been generated by AI using Claude, via the web interface.

 - Python test code has initially been generated by Claude and modified by the author.
 - Python Stubs have been auto-generated by nanobind and fixed by Claude for better type inference and clear wrapping of C++ types not converted correctly by the nanobind generator.
 - Documentation has been generated by Claude given the existing stubs and code.
 - Benchmark code has been generated by Claude.

Although LLMs are not on-par with a human brain for everything, they do a good job when it comes to summarizing/generating text given a good input, that's why it was practical to use them in that case. Critical code (cpp bindings) has been written by hand and carefully reviewed and tested.
