Skip to main content

loglocal

loglocal is a Python library for advanced local logging, built on top of loguru and pydantic. It provides configurable logging with support for both synchronous and asynchronous function decorators, file rotation, retention, and more.

Features

  • Easy-to-use logger with sensible defaults
  • Configurable via environment variables and pydantic models
  • Supports both console and file logging
  • Decorators for logging function execution (sync and async)
  • File rotation, retention, compression, and serialization

Installation

You can install loglocal via pip:

pip install loglocal

Or if you prefer to use uv (Universal Virtual Environment):

uv add loglocal

Usage

from loglocal import logger

logger.info("Hello from loglocal!")


@logger.wrap
def my_function(x, y):
  return x + y


@logger.wrap
async def my_async_function(x, y):
  return x * y

API Reference

logger

A class-level property that returns a configured LogLocal instance using default settings.

LogLocal

Extends loguru.Logger with additional configuration and decorators.

Methods

  • from_config(config: LogLocalConfig, **kwargs) -> LogLocal
    Create a logger instance from a LogLocalConfig object.

  • wrap(func=None)
    Decorator to log execution of sync or async functions.

Example

from loglocal import Logger, logger
from loglocal.models import LogLocalConfig

custom_logger = Logger(
    config=LogLocalConfig(
        ...  # Custom configuration parameters
    )
)
logger.info("Logging with default config")

Configuration

Environment Variables

  • LOGLOCAL_PATH: Path to the log file (default: logs/app.log)

You can customize logging behavior by passing a custom LogLocalConfig:

  • log_path: Path to log file (default: logs/app.log) # overrides LOGLOCAL_PATH environment variable
  • log_format: Log message format
  • log_level: Logging level (default: DEBUG)
  • log_opt: Additional options for the logger (e.g., exception, depth, colors, etc.) of type LogLocalOptions
  • log_config: Pydantic model for additional configuration options (e.g., file rotation, retention, compression, etc.) of type LogConfig

License

MIT

Release files for loglocal 1.0.5

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

Source distribution (sdist)

Source distribution for loglocal 1.0.5
File Size Uploaded
loglocal-1.0.5.tar.gz 16.0 kB Details

Built distribution (wheel)

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

Total release size: 22.3 kB

Release files / loglocal-1.0.5.tar.gz

Download URL loglocal-1.0.5.tar.gz
Size 16.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f57efe561ce612fe55f372583cc15c528e99b88dd3a1c5c39d18028fdb267c60
BLAKE2b-256 checksum
How to use checksums
bd990903e8500960de5b9774d6ffc11f802a13d74eab0c08fcc88c08f58c5da8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 17, 2025.

Transparency log

Release files / loglocal-1.0.5-py3-none-any.whl

Download URL loglocal-1.0.5-py3-none-any.whl
Size 6.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b0cd6d22ed20dbef7c6f9f22c6b64f52f99effcd3429022a91485caf7fb3555e
BLAKE2b-256 checksum
How to use checksums
2767f4d27bd0a2aadb1733100cc3164785a1270faf3565598fac5a89bf503468
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 17, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.5 This release

2 release files

1.0.4

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

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