Skip to main content

General Purpose Category Logger - A Python library for managing categorized logs in complex projects.

Project description

gpclog

简体中文 | English

General Purpose Category Logger - A Python library for managing categorized logs in complex projects.

Features

  • Category-based Logging - Each category has its own configuration and file
  • Built on loguru - High-performance, feature-rich logging core
  • Built on gpconfig - Type-safe configuration management
  • Smart Defaults - Works out of the box with zero configuration
  • Auto Class Registration - Automatically registers with GPConfigManager on import

Installation

pip install gpclog

Quick Start

Note (import side effect): importing gpclog constructs its singleton manager, which calls loguru.logger.remove() and clears any pre-existing loguru handlers. If you configure loguru yourself, do so after importing gpclog.

Basic Usage

import gpclog

# Get a category logger (zero configuration)
logger = gpclog.get_logger("my_category")
logger.info("Hello, gpclog!")
# Output to: ~/gpclog_output/my_category.log

Using Configuration Files

import gpclog
from gpconfig import GPConfigManager

# Initialize GPConfigManager (GPCLoggerConfig and GPCLogger are auto-registered)
manager = GPConfigManager("myapp")

# Method 1: Using gpclog public API
logs_folder = manager.get_config("logs")
gpclog.set_config_folder(logs_folder)
logger = gpclog.get_logger("database")

# Method 2: Using GPConfigManager directly
logger = manager.get_object("logs.database")

Configuration schema, multiprocess usage, rotation/retention, and API details are documented in docs/.

Documentation

Build and validate the documentation locally:

mkdocs build --clean --strict

Preview the documentation locally:

mkdocs serve

API Reference

See:

License

MIT

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

gpclog-0.3.0.tar.gz (39.8 kB view details)

Uploaded Source

Built Distribution

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

gpclog-0.3.0-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file gpclog-0.3.0.tar.gz.

File metadata

  • Download URL: gpclog-0.3.0.tar.gz
  • Upload date:
  • Size: 39.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for gpclog-0.3.0.tar.gz
Algorithm Hash digest
SHA256 579c408854f3540aa6d1013563a862bff3a08834d6d7168f8a0c702b477ba937
MD5 c719bc3bf03486154360b0a16dfeddc9
BLAKE2b-256 55dd0325ef32ff81fe1ca074b63f1b4ca10bae92bbe7bdf83c2ec37494cffa75

See more details on using hashes here.

Provenance

The following attestation bundles were made for gpclog-0.3.0.tar.gz:

Publisher: python-publish.yml on LinnetCodes/gpclog

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gpclog-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: gpclog-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for gpclog-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a993e3a64e3ba9436810d34274ffa0b24e4425dbf25d7d53bfd141accac88e07
MD5 4b6c90aa7c800bdd1afb58fbb924181a
BLAKE2b-256 bf8ef07920495a16747cbf89ac7f96be29c7cf8fbb127afca05794ebea4fc2d1

See more details on using hashes here.

Provenance

The following attestation bundles were made for gpclog-0.3.0-py3-none-any.whl:

Publisher: python-publish.yml on LinnetCodes/gpclog

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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