Skip to main content

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/

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

penguin_utils-0.3.0.tar.gz (19.7 kB view details)

Uploaded Source

Built Distribution

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

penguin_utils-0.3.0-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

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

Hashes for penguin_utils-0.3.0.tar.gz
Algorithm Hash digest
SHA256 c24cf3ddbafa61c61a6d7ceeb797c5698313ea7d6020e019aa1f6df842b2ae41
MD5 07276d8bb3bc854a73f732011b8cd772
BLAKE2b-256 ff0f726aeb01b43dc88ac43da9bd00fff5dc1cffd90980bddb85ad809fec71b5

See more details on using hashes here.

Provenance

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

Publisher: publish.yml on penguintechinc/penguin-libs

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

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

Hashes for penguin_utils-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 18f176a6d23e882a7b97309cad37cc0fc34314c525ac424e1c38e2509aa68bb0
MD5 f89e6b828de0763bbbc669d379cb8953
BLAKE2b-256 72f5b4f202307643f2d2492600b7e0afb04e22eaf13e097aa5f1e40b2a518664

See more details on using hashes here.

Provenance

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

Publisher: publish.yml on penguintechinc/penguin-libs

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

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page