Skip to main content

Kavach Logger

Zero-dependency logging helpers for Kavach packages and security-sensitive apps.

Install

pip install kavach-logger

For local development:

pip install -e .

What It Provides

  • DefaultLogger: simple stderr logger.
  • MaskedLogger: masks common secrets before logging.
  • get_logger(name="kavach", masked=True): create a logger instance.
  • mask_sensitive_data(text): mask a string manually.
  • BaseLogger: interface for custom loggers.
  • LoggerManager / set_custom_logger: optional singleton-style logger storage.

Quick Use

from kavach_logger import get_logger, mask_sensitive_data

logger = get_logger("api", masked=True)
logger.info("Using key sk-12345678901234567890")

plain = get_logger("debug", masked=False)
plain.info("This message is not modified")

safe_text = mask_sensitive_data("password: secret123")

Masked Patterns

MaskedLogger currently masks:

  • AKIA..., sk-..., and api_key... style values.
  • Bearer/token values.
  • 16-digit card-like numbers.
  • password, passwd, access_key, and secret fields.

Masking is best-effort. Treat it as a safety layer, not a replacement for avoiding secrets in logs.

Custom Logger

from kavach_logger import DefaultLogger, LoggerManager, set_custom_logger

class AppLogger(DefaultLogger):
    def info(self, msg, **kwargs):
        super().info(f"[APP] {msg}", **kwargs)

set_custom_logger(AppLogger("app"))
logger = LoggerManager().get_logger()
logger.info("custom logger from manager")

Logger methods accept a message and optional keyword data:

logger.info("security event", tool="db_query")
logger.warning("policy warning", rule="sql-injection")
logger.error("blocked request", user_id="u_123")
logger.debug("scanner details")

Metadata

Release files for kavach-logger 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kavach-logger 0.0.3
File Size Uploaded Provenance
kavach_logger-0.0.3.tar.gz 3.5 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for kavach-logger 0.0.3
File Interpreter ABI Platform
kavach_logger-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 8.4 kB

Release files / kavach_logger-0.0.3.tar.gz

Download URL kavach_logger-0.0.3.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
556c5d20179e557b9b19da52927888b45a14ee44b41ed9c7232eec77b1094998
BLAKE2b-256 checksum
How to use checksums
0337c5754410a85ec96100d8e0643c661e4cfab1ba527daff381281f6ec4eb18
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 13, 2026.

Transparency log

Release files / kavach_logger-0.0.3-py3-none-any.whl

Download URL kavach_logger-0.0.3-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d9b310eafb94eecdcf1ee046d11471d30aea6de4fa9e186c0a7bc493ec4fda50
BLAKE2b-256 checksum
How to use checksums
dbd0e1d1c265a9c132412f9cd479ec1e2c138c14cc13bf54dba2fa7ecb18520b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 13, 2026.

Transparency log

Security for kavach-logger 0.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for kavach_logger-0.0.3.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 13, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page