Skip to main content

No project description provided

Project description

loguru_wrapper

A lightweight wrapper around loguru that provides lazy evaluation and automatic caller context detection.

Features

  • Lazy Evaluation: Log arguments are only evaluated if the log level is enabled
  • Automatic Caller Detection: Shows actual function name and line number in logs
  • Format Conversion: Automatically converts %s format strings to {} format
  • Full Loguru Support: All log levels (debug, info, success, warning, error, critical)
  • Structured Logging: Built-in structured logging support

Installation

pip install -e /path/to/loguru_wrapper

Quick Start

from loguru_wrapper import logger

def my_function():
    log = logger()
    log.debug("User: {}", get_username)  # Lazy evaluation
    log.info("Processing %s items", item_count)  # Format conversion
    log.structured("user_login", user_id=123, success=True)

Output:

2025-07-17 09:18:27.409 | DEBUG | my_module:my_function:42 | User: john_doe
2025-07-17 09:18:27.429 | INFO  | my_module:my_function:43 | Processing 5 items
2025-07-17 09:18:27.449 | INFO  | my_module:my_function:44 | EVENT=user_login user_id=123 success=True

Configuration

from loguru_wrapper import logger, LoggerConfig

config = LoggerConfig(
    default_level="DEBUG",
    enable_lazy=True
)
log = logger(config=config)

Requirements

  • Python ≥ 3.10
  • loguru ≥ 0.7.3
  • stackwalker ≥ 0.4.2

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

loguru_wrapper-0.2.1-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file loguru_wrapper-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: loguru_wrapper-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for loguru_wrapper-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 01d4acd2006d156fcff946a2b09d6a5a7712ea260146a4971e9d2d3b116de286
MD5 f8687374f27be3ee771b803bf3c6b1e4
BLAKE2b-256 54938536460a0882b70cf96e37b361bfcaf4655855bf6d8f563733284fe4e3a5

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