Developer-friendly logging helpers for Azure Functions Python
Project description
azure-functions-logging
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
loggingmodule - 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] messageformat setup_logging()one-liner configurationget_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.jsonlog level conflict warning- Exception-friendly output with readable stack traces
- Compatible with Python's standard
loggingmodule
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
Release history Release notifications | RSS feed
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 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a998909d4569d299eb634bf9eeaeb551f8ba02ae0f1ddf8054cc9b4384d1b2f
|
|
| MD5 |
2c80ed3bac58b857763e35878d90ad90
|
|
| BLAKE2b-256 |
f89417df3f992d848bf8ca761fbacef19126c1bd80fac3e3ca54d1959a667587
|
Provenance
The following attestation bundles were made for azure_functions_logging-0.2.0.tar.gz:
Publisher:
release.yml on yeongseon/azure-functions-logging
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
azure_functions_logging-0.2.0.tar.gz -
Subject digest:
4a998909d4569d299eb634bf9eeaeb551f8ba02ae0f1ddf8054cc9b4384d1b2f - Sigstore transparency entry: 1090479416
- Sigstore integration time:
-
Permalink:
yeongseon/azure-functions-logging@d776dd1170f7c9dc250e49d45030961c58d95c60 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/yeongseon
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d776dd1170f7c9dc250e49d45030961c58d95c60 -
Trigger Event:
push
-
Statement type:
File details
Details for the file azure_functions_logging-0.2.0-py3-none-any.whl.
File metadata
- Download URL: azure_functions_logging-0.2.0-py3-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
82d7fbb23131d6fc98045194d34ac90dc2c200494b9f6dd28ff0266e4aa0b98a
|
|
| MD5 |
0e1ce124bb94d515130f87a99848c0a1
|
|
| BLAKE2b-256 |
b27803e05b8dfdafb5a8f79172e24cde45d985f1240ce99e4fafe2c0c0c694a0
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
azure_functions_logging-0.2.0-py3-none-any.whl -
Subject digest:
82d7fbb23131d6fc98045194d34ac90dc2c200494b9f6dd28ff0266e4aa0b98a - Sigstore transparency entry: 1090479420
- Sigstore integration time:
-
Permalink:
yeongseon/azure-functions-logging@d776dd1170f7c9dc250e49d45030961c58d95c60 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/yeongseon
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d776dd1170f7c9dc250e49d45030961c58d95c60 -
Trigger Event:
push
-
Statement type: