Skip to main content

LoggerPlusPlus is an enhanced Python logging module with colorized output, customizable themes, improved multi-logger management, and optimized display for better readability. Built on top of Loguru, it adds a set of features that make logging faster and more convenient to use.

Project description

LoggerPlusPlus

LoggerPlusPlus is an enhanced Python logging module built on top of Loguru.
It provides the same simple and powerful API, while adding extra features for better readability, productivity, and multi-logger management.


✨ Features

  • Dynamic identifier alignment:
    Use {identifier:<auto} in your log format and all identifiers will be aligned automatically, with width adapting to the longest seen identifier.

  • Truncation support:
    Define a maximum width with [...] and choose how truncation should occur:

{identifier:<auto[18~middle]} → if the identifier is longer than 18 chars, it will be truncated with in the middle.

  • LoggerClass: Any class can easily get a bound logger with its class name as identifier:

    from loggerPlusPlus import LoggerClass
    
    class Worker(LoggerClass):
        def run(self):
            self.logger.info("Working...")
    
  • Extra decorators:

    • @catch → same as loguru.logger.catch, with optional identifier or a pre-bound logger.
    • opt() → same as loguru.logger.opt, extended with identifier or logger binding.
    • @log_timing → log execution time of functions (enter/exit messages configurable).
    • @log_io → log function parameters and/or return values.
  • Compatible with Loguru: All of Loguru’s core features (sinks, levels, filters, backtraces, etc.) remain available.


🚀 Installation

pip install loggerplusplus

🛠 Usage

Basic configuration

from loggerplusplus import add, remove, logger

remove()
add(
    sink=sys.stderr,
    level="DEBUG",
    format=(
        "<green>{time:YYYY-MM-DD HH:mm:ss.SSS}</green> | "
        "<level>{level.name:<8}</level> | "
        "[<blue>{identifier:<auto[18~middle]}</blue>] | "
        "<level>{message}</level>"
    ),
)

logger.bind(identifier="MAIN").info("Hello from main")

Output:

2025-09-25 14:03:12.345 | INFO     | [MAIN] | Hello from main

LoggerClass mixin

from loggerplusplus import LoggerClass

class Service(LoggerClass):
    def run(self):
        self.logger.info("Service is running")

svc = Service()
svc.run()

Decorators

Catch exceptions

from loggerplusplus import catch

@catch(identifier="WORKER", level="ERROR")
def risky():
    raise RuntimeError("Boom!")

risky()

Measure execution time

from loggerplusplus import log_timing
import time

@log_timing(identifier="TASK", enter_message="Starting {func}...", exit_message="Finished {func} in {duration:.2f}s")
def slow():
    time.sleep(0.5)

slow()

Log function arguments / return values

from loggerplusplus import log_io

@log_io(identifier="CALC", log_args=True, log_return=True)
def add(a, b):
    return a + b

add(3, 4)

📜 License

loggerplusplus is licensed under the GPLv3. It builds on top of Loguru (MIT license).

Author

Project created and maintained by Florian BARRE.
For any questions or contributions, feel free to contact me.
My Website | My LinkedIn | My GitHub

Project details


Download files

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

Source Distribution

loggerplusplus-1.0.0.tar.gz (54.8 kB view details)

Uploaded Source

Built Distribution

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

loggerplusplus-1.0.0-py3-none-any.whl (47.0 kB view details)

Uploaded Python 3

File details

Details for the file loggerplusplus-1.0.0.tar.gz.

File metadata

  • Download URL: loggerplusplus-1.0.0.tar.gz
  • Upload date:
  • Size: 54.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for loggerplusplus-1.0.0.tar.gz
Algorithm Hash digest
SHA256 7807f45b68493432eedb3b88ab064edca50ac6b9f67b215f575c5b1381edc3d8
MD5 83d724ea1912b3fc1e93885774d33ba4
BLAKE2b-256 ba1ed57c1a0508f0e3c507c0d1285933aa1ccf3c0cd1878d99111f4383db33c9

See more details on using hashes here.

File details

Details for the file loggerplusplus-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: loggerplusplus-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 47.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for loggerplusplus-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e1dff7007e4135461551ea22802657a8e210a72b9feb043cb2140a897c2c82e0
MD5 45bc117918da5d2c8f47aef19450de47
BLAKE2b-256 ce323f0a2831002f6ef94d1ee9c7a6482c3f1d44aeefa9185a554f553f06c1dd

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 Pingdom Monitoring Sentry Error logging StatusPage Status page