Skip to main content

Developer-friendly logging helpers for Azure Functions Python

Project description

azure-functions-logging

PyPI Python Version CI License: MIT

Developer-friendly logging helpers for the Azure Functions Python v2 programming model.

Why Use It

Azure Functions Python handlers share the same logging pain points:

  • log output is visually dense and hard to scan
  • errors do not stand out from info-level noise
  • default formatting is not optimized for human readability

azure-functions-logging provides colorized, cleanly formatted log output that works with Python's standard logging module and requires minimal setup.

Scope

  • Azure Functions Python v2 programming model
  • Python's standard logging module
  • Colorized and JSON log output
  • Invocation context injection and cold start detection

This package does not target distributed tracing, log aggregation, or OpenTelemetry integration.

Features

  • Colorized log levels (DEBUG gray, INFO blue, WARNING yellow, ERROR red, CRITICAL bold red)
  • JSON structured log output for production and CI environments
  • Clean [TIME] [LEVEL] [LOGGER] message format
  • setup_logging() one-liner configuration
  • get_logger(__name__) helper for convenient logger creation
  • Automatic invocation context injection (invocation_id, function_name, trace_id)
  • Cold start detection without manual instrumentation
  • Context binding via logger.bind(user_id="abc")
  • host.json log level conflict warning
  • Exception-friendly output with readable stack traces
  • Compatible with Python's standard logging module

Installation

pip install azure-functions-logging

Quick Start

from azure_functions_logging import get_logger, setup_logging

setup_logging()

logger = get_logger(__name__)
logger.info("Processing request")

JSON Output

setup_logging(format="json")

logger = get_logger(__name__)
logger.info("Processing request")
# {"timestamp": "...", "level": "INFO", "logger": "...", "message": "Processing request", ...}

Context Injection

from azure_functions_logging import inject_context

def my_function(req, context):
    inject_context(context)
    logger.info("Handling request")  # includes invocation_id, function_name, trace_id

Context Binding

bound = logger.bind(user_id="abc", operation="checkout")
bound.info("Processing")  # includes user_id + operation in every log line

Development

git clone https://github.com/yeongseon/azure-functions-logging.git
cd azure-functions-logging
pip install -e .[dev]

Documentation

  • Product requirements: PRD.md

Disclaimer

This project is an independent community project and is not affiliated with, endorsed by, or maintained by Microsoft.

Azure and Azure Functions are trademarks of Microsoft Corporation.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

azure_functions_logging-0.2.1.tar.gz (24.6 kB view details)

Uploaded Source

Built Distribution

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

azure_functions_logging-0.2.1-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file azure_functions_logging-0.2.1.tar.gz.

File metadata

  • Download URL: azure_functions_logging-0.2.1.tar.gz
  • Upload date:
  • Size: 24.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for azure_functions_logging-0.2.1.tar.gz
Algorithm Hash digest
SHA256 a63cedd309d18b206675d9f9ccc975223ad23917f246ae3fc466ccdfae286dde
MD5 095795a9ce54ad675793e73d687cffbc
BLAKE2b-256 402422b4bb68b4c060426056ccca6e647b4d6c1ed00e1c5f529cbc6a712aa9df

See more details on using hashes here.

Provenance

The following attestation bundles were made for azure_functions_logging-0.2.1.tar.gz:

Publisher: release.yml on yeongseon/azure-functions-logging

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

File details

Details for the file azure_functions_logging-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for azure_functions_logging-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2e3a5091ec9d4b0cd75efb42f6d89e8bd5764f7010efc216481c48b0dcd7fc68
MD5 86b78d05da82cedaa0a5835a6bbfa838
BLAKE2b-256 35e98da2e9c47c55686fe3203ed0e3b3d0d9b5fd472a45d0ecf025fcca17a172

See more details on using hashes here.

Provenance

The following attestation bundles were made for azure_functions_logging-0.2.1-py3-none-any.whl:

Publisher: release.yml on yeongseon/azure-functions-logging

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

Supported by

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