Skip to main content

NexusLog

License Python Version

High-performance async logging library, compatible with Python standard logging API.

中文文档

Benchmark

Benchmark chart

Benchmarking with 1,000,000 log messages

------------------------------------------------------------
Logger               Time (s)     Msgs/sec        Log size    
------------------------------------------------------------
loguru               7.675        130,297         89,888,890 bytes
Python logging       5.313        188,206         82,888,890 bytes
picologging          2.038        490,626         79,888,888 bytes
spdlog               0.199        5,034,527       79,888,890 bytes
NexusLogger          0.049        20,304,036      97,888,890 bytes
NexusLogger unix_ts  0.049        20,451,884      83,868,922 bytes
------------------------------------------------------------

NexusLogger is 4.03x faster than spdlog
NexusLogger is 41.38x faster than picologging
NexusLogger is 107.88x faster than Python logging
NexusLogger is 155.83x faster than loguru
NexusLogger unix_ts is 4.06x faster than spdlog
NexusLogger unix_ts is 41.69x faster than picologging
NexusLogger unix_ts is 108.67x faster than Python logging
NexusLogger unix_ts is 156.96x faster than loguru

Installation

pip install nexuslog

Quick Start

import nexuslog as logging

logging.basicConfig(level=logging.INFO)

logging.info("Hello, world!")
logging.warning("This is a warning")
logging.error("This is an error")

API

Log Levels

logging.TRACE
logging.DEBUG
logging.INFO
logging.WARNING
logging.ERROR

Module-level Functions

logging.basicConfig(filename=None, level=logging.INFO, unix_ts=False, color="auto", format="logfmt")
logging.basicConfig(
    level=logging.INFO,
    name_levels={"db": logging.DEBUG, "http.client": logging.WARNING},
)
logging.trace(message, *args)
logging.debug(message, *args)
logging.info(message, *args)
logging.warning(message, *args)
logging.error(message, *args)

Lazy %-style Formatting

Like the standard logging module, extra arguments are merged into the message with %-style formatting — but only if the log level is enabled. When the level is disabled, the arguments are never formatted (no str()/repr() calls), making disabled log calls nearly free:

logger.info("price=%s qty=%s side=%s", price, qty, side)
logger.debug("state=%r retries=%d", state, retries)  # zero cost at INFO level

Supported conversions: %s %r %d %i %f %e %g %x %o %%, plus the full % operator spec (width, precision, flags, %(name)s with a dict argument) with semantics identical to Python's message % args. Simple placeholders are rendered natively in Rust — formatting with args is faster than building the message with an f-string at the call site. A message logged without args is emitted verbatim, so literal % needs no escaping.

Colored Output

logging.basicConfig(color="auto")  # default

The color option controls ANSI colorization of the level value (by severity) and the logfmt keys (dimmed):

  • "auto" (default) — color only when writing to a color-capable terminal. File and piped output stay plain. Honors the NO_COLOR (force off) and FORCE_COLOR (force on) environment variables; NO_COLOR wins.
  • "off" — never emit ANSI color.
  • "always" — always emit ANSI color, even to files and pipes.

Colors: error red, warn yellow, info green, debug cyan, trace dim. The message body is never colored. There is no cost on the hot path when color is inactive.

JSON Output

logging.basicConfig(filename="app.log", format="json")

format selects the line layout:

  • "logfmt" (default) — time=... level=... [name=...] msg="...".

  • "json" — one JSON object per line (NDJSON):

    {"time":"2026-07-09T09:45:59.914644+08:00","level":"warn","name":"svc","msg":"disk 90% full"}
    

    Fields are {time, level, name, msg}, with proper JSON escaping of the message. time is an ISO-8601 string, or a number when unix_ts=True. name is omitted when unset. JSON output ignores color (it is never colorized).

NDJSON is the recommended format for shipping logs to a database: write to a file, then let a forwarder (Vector, Fluent Bit, Fluentd, Logstash) tail it and insert into ClickHouse / PostgreSQL / etc. — the JSON parses with near-zero configuration.

Logger Class

from nexuslog import Logger, Level

logger = Logger("myapp", path="/var/log/app", level=Level.Info)
logger.info("message")
logger.shutdown()

getLogger

import nexuslog as logging

logging.basicConfig(filename="/var/log/app.log", level=logging.DEBUG)
logger = logging.getLogger("myapp")
logger.info("message")

License

MIT

Download files

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

Source Distribution

nexuslog_lib-0.9.0.tar.gz (173.8 kB view details)

Uploaded Source

Built Distributions

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

nexuslog_lib-0.9.0-cp314-cp314-win_amd64.whl (234.4 kB view details)

Uploaded CPython 3.14Windows x86-64

nexuslog_lib-0.9.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (367.7 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64

nexuslog_lib-0.9.0-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (367.1 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ ARM64

nexuslog_lib-0.9.0-cp314-cp314-macosx_11_0_arm64.whl (333.5 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

nexuslog_lib-0.9.0-cp314-cp314-macosx_10_12_x86_64.whl (343.2 kB view details)

Uploaded CPython 3.14macOS 10.12+ x86-64

nexuslog_lib-0.9.0-cp313-cp313-win_amd64.whl (234.4 kB view details)

Uploaded CPython 3.13Windows x86-64

nexuslog_lib-0.9.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (367.9 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

nexuslog_lib-0.9.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (367.3 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

nexuslog_lib-0.9.0-cp313-cp313-macosx_11_0_arm64.whl (333.4 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

nexuslog_lib-0.9.0-cp313-cp313-macosx_10_12_x86_64.whl (343.3 kB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

nexuslog_lib-0.9.0-cp312-cp312-win_amd64.whl (234.8 kB view details)

Uploaded CPython 3.12Windows x86-64

nexuslog_lib-0.9.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (368.3 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

nexuslog_lib-0.9.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (367.6 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

nexuslog_lib-0.9.0-cp312-cp312-macosx_11_0_arm64.whl (333.5 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

nexuslog_lib-0.9.0-cp312-cp312-macosx_10_12_x86_64.whl (344.3 kB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

nexuslog_lib-0.9.0-cp311-cp311-win_amd64.whl (236.0 kB view details)

Uploaded CPython 3.11Windows x86-64

nexuslog_lib-0.9.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (368.0 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

nexuslog_lib-0.9.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (367.8 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

nexuslog_lib-0.9.0-cp311-cp311-macosx_11_0_arm64.whl (333.4 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

nexuslog_lib-0.9.0-cp311-cp311-macosx_10_12_x86_64.whl (343.5 kB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

File details

Details for the file nexuslog_lib-0.9.0.tar.gz.

File metadata

  • Download URL: nexuslog_lib-0.9.0.tar.gz
  • Upload date:
  • Size: 173.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for nexuslog_lib-0.9.0.tar.gz
Algorithm Hash digest
SHA256 4fead48af10427db10292fb3f079e7e1f9fea21f0823f6e70dfa8c16bd2cdabf
MD5 e64469093065c9b06bb54ed80da3fe01
BLAKE2b-256 9301c0063128a31367f9f6978f86bfca12b8f161d89510910675a3580f678ab3

See more details on using hashes here.

File details

Details for the file nexuslog_lib-0.9.0-cp314-cp314-win_amd64.whl.

File metadata

File hashes

Hashes for nexuslog_lib-0.9.0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 d64700e922f743315f26327396b7b23202520f4d8e86f1723995c8fc00c3a74c
MD5 f73e1dd1571a24e31631cbebf6280225
BLAKE2b-256 f89d60c9a8b757e359c9bcbc5db4f160c5937b6842e8e86ce730a1c4eb579cb3

See more details on using hashes here.

File details

Details for the file nexuslog_lib-0.9.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for nexuslog_lib-0.9.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ab859e51ef5278d97ea605bdcc6035131e392dbf06b57f05b85065cf1164703b
MD5 e41e4d70e2a3b4b727479301401976fe
BLAKE2b-256 4600eebeb393d5ddd44b10be0b2916962a5a374aee20b7632a6026a0bc895975

See more details on using hashes here.

File details

Details for the file nexuslog_lib-0.9.0-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for nexuslog_lib-0.9.0-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3ec4064930e6e85b06c61ae706ec7195d34bdabc0c29d11bcfb5e19e4b963c07
MD5 8494a49825e45b20d112781eab7119b5
BLAKE2b-256 d78a456f0a9a6df741c5ca5f50ccbeb910b5b08879413d875ea516627e192c82

See more details on using hashes here.

File details

Details for the file nexuslog_lib-0.9.0-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for nexuslog_lib-0.9.0-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d610c22de0a1f9ef46e7e8df2b4974a2058a3b342c56cbeae0a2cace3392388f
MD5 cd716b156feb5f7aee120ab3dbafa7e6
BLAKE2b-256 a0704d5df4dc1057f541ddcad7ffa33b42fbfd3cd8ad5da580a21eee442d55a5

See more details on using hashes here.

File details

Details for the file nexuslog_lib-0.9.0-cp314-cp314-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for nexuslog_lib-0.9.0-cp314-cp314-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 0fa6f6cffd7447e2bd54baf31b0cef676e0cdc76a2efaf8e77e4a3fa768a628f
MD5 5fea86b2883592148fe0e316bb1736b5
BLAKE2b-256 498cf8f1659e0344580dc89986111bd542f850e7e40a3cb167a2f4f7a1c537f9

See more details on using hashes here.

File details

Details for the file nexuslog_lib-0.9.0-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for nexuslog_lib-0.9.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 69d58af1157f6743bd3ddfdd7c4752723a64bfca26ea1e3a223f144f9a330b63
MD5 9f2817700ec1d1a011b034eee859883b
BLAKE2b-256 ddf848320616a6d69895eb7778b55ab2e53c7b6574ad276256c71a25dcf7cd69

See more details on using hashes here.

File details

Details for the file nexuslog_lib-0.9.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for nexuslog_lib-0.9.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a5da2825391516bc3dfe62fc79b0f0956726c81e1fed98584bc2ac719a3e8e93
MD5 4ea86e850059659dabc2c6334bce2a90
BLAKE2b-256 12c85a67555f934a5e309a1908f929a544e0cd48333e8eb5d77bd41888376196

See more details on using hashes here.

File details

Details for the file nexuslog_lib-0.9.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for nexuslog_lib-0.9.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4dca9df9390a06159ebd7c434f309b93557774379c96d3f08699dfcba1d107d5
MD5 91298b6690b9f8fdaa6e1e2c6aa69215
BLAKE2b-256 c7e26858423950621dc804866b5cc548ce9344b9c5317d68c160f54069c3309f

See more details on using hashes here.

File details

Details for the file nexuslog_lib-0.9.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for nexuslog_lib-0.9.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d2a1331052cc91f743d995ed2234e31a2cba9d5c497099b2e709ff84981c8b70
MD5 b4dacd2c1c61d079f4238d291afc4f9a
BLAKE2b-256 89da48abe824d3285ceb538d071ca4e0645fac2482dae0b9cca9b000339ffe2a

See more details on using hashes here.

File details

Details for the file nexuslog_lib-0.9.0-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for nexuslog_lib-0.9.0-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 a6d16bf3dda454a59e4b0139f98d702e6671b2743c3d086bb9f905666b377b5a
MD5 0c082e19779d8fac7067b0596b8c965a
BLAKE2b-256 1ffd9249c7abbe3196a0b6b34b2be873c8ee14e00d675ed9eaecb8bc3edeee93

See more details on using hashes here.

File details

Details for the file nexuslog_lib-0.9.0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for nexuslog_lib-0.9.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 d179ed4a09640b9d0c9ce34c4852423cd5f84bf3943c7a8ab58ff1eeab3cfdb9
MD5 2a65f591276a98dba19bf855c8f8133e
BLAKE2b-256 6ba0c9cbcb8936bdcfc1e7fc696d68a342c50d4345e06a69b51c1a4186f92796

See more details on using hashes here.

File details

Details for the file nexuslog_lib-0.9.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for nexuslog_lib-0.9.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5d78e169a62a7d275d7f9b6d9d551e329694f6c72973038324b62f4375b681f9
MD5 80ff4564a743da842062bb4d0950cce0
BLAKE2b-256 506ef22296db68e60d28d06bc4e4e011bd4ea2406b58a14f6a7d71c5a85bec00

See more details on using hashes here.

File details

Details for the file nexuslog_lib-0.9.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for nexuslog_lib-0.9.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7e9ef52c765727129614f74f127a60c24a729da4cdb06212b10d81381f874a79
MD5 dca70b07204c0d5fb3253547719c492a
BLAKE2b-256 cb2e2c2aa7abc1da9e01156a5647dee863cfac34712494e3d10326a2dc078c50

See more details on using hashes here.

File details

Details for the file nexuslog_lib-0.9.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for nexuslog_lib-0.9.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7901ce16cffe49117f312cb1222988660d830f8dc03b838472e838e38c2f70fa
MD5 50c695eb893f09d5e73b92bdea379a18
BLAKE2b-256 b00756935b292bd889f3df62742069a204af2693a70dcc2485db2f765f9424e3

See more details on using hashes here.

File details

Details for the file nexuslog_lib-0.9.0-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for nexuslog_lib-0.9.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 a45054cdecbc26ae682723399609bcec9e066e7fa1fbf8157b55178e526b2858
MD5 4fde64cdf47e6b5db535dee12d5a6af0
BLAKE2b-256 3e7b037584154db9ef0f7e9e89cb6652a10e721332b0ea0477825f5984751a3c

See more details on using hashes here.

File details

Details for the file nexuslog_lib-0.9.0-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for nexuslog_lib-0.9.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 10c9ad2a69fe7428327c4504a24b9757a9364486f1464af2d78d46ec9d4ab531
MD5 4946893b591ddc55da856bec8bab739b
BLAKE2b-256 953fcd95844bc605213db032d8b85b8bf7ad955ce2c2d8a5692f23514668fcce

See more details on using hashes here.

File details

Details for the file nexuslog_lib-0.9.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for nexuslog_lib-0.9.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4b95110f078c89589ee65b8e5cc5e3a7dcf26cbe61dec9bdf39936bbdcd3ccf1
MD5 59061624796be18fa66f266fa932cecb
BLAKE2b-256 0ca02894e880bf0b64e1b9daf37bd04e4dd38d8c138fbc23c429ce20fac57b60

See more details on using hashes here.

File details

Details for the file nexuslog_lib-0.9.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for nexuslog_lib-0.9.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 32302c4ce6149b0d22cdb0102d2aeb58eb51db6844a7db346478f62f4a0c356f
MD5 75b166169119da7bf2ffd2a49361780e
BLAKE2b-256 05b51cde33be8e3b845d67c54ca5349df41bf631afeb50e540152f0e5575a380

See more details on using hashes here.

File details

Details for the file nexuslog_lib-0.9.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for nexuslog_lib-0.9.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 81d2952c65e2762c99fce4b6e466a3582083b7f427b7a668748708015bdfe5b7
MD5 c477d96f738e977ab0b6b46a2b54afeb
BLAKE2b-256 399b59175c9416ef5b5f017ea852d045024fef886ba6e0d1b96a463d0c2805e4

See more details on using hashes here.

File details

Details for the file nexuslog_lib-0.9.0-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for nexuslog_lib-0.9.0-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 27ab0d8f093f6c71993e1826b95672a78a82890a8db1c66a79bfd0406cb48486
MD5 d922c516be28265b91bfee90392de81e
BLAKE2b-256 735a86da22ec04eadd3555c0a8c22ae84da6eb9dbf1d2639164e240975d5283e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page