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-safe-python 0.0.1
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_safe_python-0.0.1.tar.gz | 73.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ss_utils_safe_python-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 77.7 kB
Release files / ss_utils_safe_python-0.0.1.tar.gz
| Download URL | ss_utils_safe_python-0.0.1.tar.gz |
|---|---|
| Size | 73.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f7918dbeb38cf21688808cfcda1e161ce06e1ee7cfb79410dee15f1dfc821de8
|
|
BLAKE2b-256 checksum How to use checksums |
739ed83c95a07d976cc2e3f84b1ecd8a22ed5f4f0ac25ca91da9108e60a96e63
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.13
|
Release files / ss_utils_safe_python-0.0.1-py3-none-any.whl
| Download URL | ss_utils_safe_python-0.0.1-py3-none-any.whl |
|---|---|
| Size | 3.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
496ebb1f6b76901b0b54fa242e588aca2d3a92b3ee90e963f02649580bc048fa
|
|
BLAKE2b-256 checksum How to use checksums |
edd7c7f7ecd35dea218886ce35bd1ed04b433e5c451a182489f808f1db6d3346
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.13
|