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.0.tar.gz (24.5 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.0-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: azure_functions_logging-0.2.0.tar.gz
  • Upload date:
  • Size: 24.5 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.0.tar.gz
Algorithm Hash digest
SHA256 4a998909d4569d299eb634bf9eeaeb551f8ba02ae0f1ddf8054cc9b4384d1b2f
MD5 2c80ed3bac58b857763e35878d90ad90
BLAKE2b-256 f89417df3f992d848bf8ca761fbacef19126c1bd80fac3e3ca54d1959a667587

See more details on using hashes here.

Provenance

The following attestation bundles were made for azure_functions_logging-0.2.0.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.0-py3-none-any.whl.

File metadata

File hashes

Hashes for azure_functions_logging-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 82d7fbb23131d6fc98045194d34ac90dc2c200494b9f6dd28ff0266e4aa0b98a
MD5 0e1ce124bb94d515130f87a99848c0a1
BLAKE2b-256 b27803e05b8dfdafb5a8f79172e24cde45d985f1240ce99e4fafe2c0c0c694a0

See more details on using hashes here.

Provenance

The following attestation bundles were made for azure_functions_logging-0.2.0-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