ss-utils-logging
A Python logging utility package with orjson serialization and advanced configuration features.
Features
- ORJSON Serialization: High-performance JSON logging with orjson
- YAML Configuration: Easy logging setup using YAML configuration files
- Merging Logger Adapter: Advanced adapter that properly merges extra fields (fixes Python <3.13 limitation)
- Console & JSON Formatters: Flexible formatting options for different output needs
- Config File Generation: Automatically generate example configuration files
Installation
uv add ss-utils-logging
Quick Start
# [one-time] Generate example configuration files in `config/` folder
# This creates example YAML configuration files (logging.yaml and logging.prod.yaml) that you can customize for your needs.
uv run ss-utils-logging config --no-overwrite
from ss_utils_logging import configure_logging, get_logger, generate_config_files
# Configure logging with YAML file
configure_logging("config/logging.yaml")
# Set up a logger with extra context
logger = get_logger(__name__, extra={"service": "my-app", "version": "1.0.0"})
# Log with additional context (optional)
logger.info("Processing request", user_id=123, action="login")
Key Components
MergingLoggerAdapter
Fixes the Python <3.13 limitation where LoggerAdapter doesn't properly merge extra fields from both the adapter and individual log calls.
Formatters
ConsoleFormatter: Human-readable console outputORJSONFormatter: High-performance JSON output using orjson
Configuration Management
configure_logging(): Set up logging from YAML configurationgenerate_config_files(): Create example configuration filesget_logger(): Get logger instances with optional extra context
Test notes
- Tested only on macos
Release files for ss-utils-logging 0.0.11
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ss_utils_logging-0.0.11.tar.gz | 65.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ss_utils_logging-0.0.11-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 74.7 kB
Release files / ss_utils_logging-0.0.11.tar.gz
| Download URL | ss_utils_logging-0.0.11.tar.gz |
|---|---|
| Size | 65.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
018b8bc9eab18cbd591a74beded842b03b8b84ac9757ef0e7aa3418a6030678b
|
|
BLAKE2b-256 checksum How to use checksums |
344476a75647afb73f23d2f9b1a7d30199176f2136c4e382dd846964c139940c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.7
|
Release files / ss_utils_logging-0.0.11-py3-none-any.whl
| Download URL | ss_utils_logging-0.0.11-py3-none-any.whl |
|---|---|
| Size | 9.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b3b686c823d1f8fb25b51c000280d071b295af5d1539303682a8b37c503e96ce
|
|
BLAKE2b-256 checksum How to use checksums |
593cf2ea8ea0b9c4cd47a80e9c4d7ee4d43177a73d5d97b79ff29c8066d72031
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.7
|