penguin-utils
Sanitized structured logging for Python microservices. Automatically redacts PII (passwords, tokens, emails) before writing to any output sink. Supports stdout, file, syslog, AWS CloudWatch, GCP Cloud Logging, and Apache Kafka.
Installation
pip install penguin-utils
# Optional cloud backends:
pip install penguin-utils[cloudwatch] # AWS CloudWatch Logs
pip install penguin-utils[gcp] # Google Cloud Logging
pip install penguin-utils[kafka] # Apache Kafka
Quick Start
from penguintechinc_utils import SanitizedLogger
from penguintechinc_utils.sinks import StdoutSink
logger = SanitizedLogger("MyComponent", sinks=[StdoutSink()])
logger.info("User login attempt", {
"email": "user@example.com", # Logged as: [email]@example.com
"password": "secret123", # Logged as: [REDACTED]
"remember_me": True, # Logged as-is
})
Auto-Configure from Environment
from penguintechinc_utils.logging import configure_logging_from_env
from penguintechinc_utils import SanitizedLogger
logger = SanitizedLogger("MyApp", sinks=configure_logging_from_env())
Dynamic Decorator Builder
Eliminates traditional 3-tier function boilerplate for Python decorators.
from penguintechinc_utils import add_decorator
@add_decorator(name="my-cool-decorator")
def my_cool_decorator(ctx):
print(f"Calling {ctx.func.__name__} with decorator args: {ctx.dec_kwargs}")
ctx.execution_time = 0
return ctx.proceed()
# Use with or without parameters on sync or async functions:
@my_cool_decorator(tag="v1")
def process_data(item):
return item.upper()
📚 Full documentation: docs/penguin-utils/
- README — complete feature overview and all sinks
- API Reference — all classes and methods
- Changelog
- Migration Guide — upgrading to 0.2.x cloud sinks
License
MIT — See LICENSE for details.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file penguin_utils-0.3.0.tar.gz.
File metadata
- Download URL: penguin_utils-0.3.0.tar.gz
- Upload date:
- Size: 19.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c24cf3ddbafa61c61a6d7ceeb797c5698313ea7d6020e019aa1f6df842b2ae41
|
|
| MD5 |
07276d8bb3bc854a73f732011b8cd772
|
|
| BLAKE2b-256 |
ff0f726aeb01b43dc88ac43da9bd00fff5dc1cffd90980bddb85ad809fec71b5
|
Provenance
The following attestation bundles were made for penguin_utils-0.3.0.tar.gz:
Publisher:
publish.yml on penguintechinc/penguin-libs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
penguin_utils-0.3.0.tar.gz -
Subject digest:
c24cf3ddbafa61c61a6d7ceeb797c5698313ea7d6020e019aa1f6df842b2ae41 - Sigstore transparency entry: 2415455163
- Sigstore integration time:
-
Permalink:
penguintechinc/penguin-libs@8b026744f5dd8308c0d953a370732bdc9efcf53b -
Branch / Tag:
refs/tags/penguin-utils-v0.3.0 - Owner: https://github.com/penguintechinc
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8b026744f5dd8308c0d953a370732bdc9efcf53b -
Trigger Event:
push
-
Statement type:
File details
Details for the file penguin_utils-0.3.0-py3-none-any.whl.
File metadata
- Download URL: penguin_utils-0.3.0-py3-none-any.whl
- Upload date:
- Size: 14.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
18f176a6d23e882a7b97309cad37cc0fc34314c525ac424e1c38e2509aa68bb0
|
|
| MD5 |
f89e6b828de0763bbbc669d379cb8953
|
|
| BLAKE2b-256 |
72f5b4f202307643f2d2492600b7e0afb04e22eaf13e097aa5f1e40b2a518664
|
Provenance
The following attestation bundles were made for penguin_utils-0.3.0-py3-none-any.whl:
Publisher:
publish.yml on penguintechinc/penguin-libs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
penguin_utils-0.3.0-py3-none-any.whl -
Subject digest:
18f176a6d23e882a7b97309cad37cc0fc34314c525ac424e1c38e2509aa68bb0 - Sigstore transparency entry: 2415455239
- Sigstore integration time:
-
Permalink:
penguintechinc/penguin-libs@8b026744f5dd8308c0d953a370732bdc9efcf53b -
Branch / Tag:
refs/tags/penguin-utils-v0.3.0 - Owner: https://github.com/penguintechinc
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8b026744f5dd8308c0d953a370732bdc9efcf53b -
Trigger Event:
push
-
Statement type: