--- id: structlog-gcp version: "0.5.1" license: The MIT License (MIT) Copyright (c) Jonathan Ballet and contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files… (full text in the JSON record) license_treatment: unclear maintenance: active --- # structlog-gcp — A structlog set of processors to output as Google Cloud Logging format License: unclear · Maintenance: active · Downloads: 414.4K/mo ## What it is and what it does structlog-gcp is a formatter package that bridges structlog and Google Cloud Logging. It provides processors that convert structlog output into the JSON format expected by Google Cloud Logging, with built-in support for translating Python log levels to GCP equivalents and automatic error reporting to Google Error Reporting. The package is designed for applications running on GKE, Cloud Functions, or Cloud Run—environments where logs are written to stdout and picked up by Google's logging infrastructure. The package handles three main concerns: formatting logs as JSON, managing context variables across loggers, and detecting exceptions to report them to Error Reporting. It offers a simple configuration path via `build_processors()` for typical use cases, and a lower-level `build_gcp_processors()` for applications that need finer control over the processor chain or custom JSON serializers. Use it for: - Format structlog output for GKE applications so logs appear correctly in Google Cloud Logging console. - Automatically report exceptions and CRITICAL messages to Google Error Reporting dashboard. - Configure Cloud Run services to emit structured logs with service name and revision from environment variables. - Integrate structlog with custom processors while maintaining Google Cloud Logging compatibility. - Bind request-scoped context variables to logs across multiple logger calls in a single request. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Configures structlog to output logs in Google Cloud Logging JSON format, with automatic error reporting and context variable support. Yes, if you run Python applications on Google Cloud infrastructure (GKE, Cloud Run, Cloud Functions) and use structlog for logging. The package is actively maintained, has low install friction, and solves a specific integration problem with no known vulnerabilities. Install with caution only if you are not using Google Cloud Logging or prefer a different structured logging approach. ## Install pip install structlog-gcp uv add structlog-gcp poetry add structlog-gcp ## Installing structlog-gcp Before you install: Low install friction with a single runtime dependency (structlog). Actively maintained with recent releases; last commit 2026-08-11 and latest release 2026-07-07. Supports current Python versions (3.10–3.13). License in practice: MIT license permits unrestricted use, modification, and distribution with minimal obligations—suitable for both open-source and commercial projects. Quickstart: pip install structlog-gcp import structlog import structlog_gcp processors = structlog_gcp.build_processors() structlog.configure(processors=processors) logger = structlog.get_logger() logger.info("Hello world") Requires Python 3.10 or later; structlog must be installed as a runtime dependency. Verify before relying: - Whether the package works with structlog versions prior to a specific release, or if there are known incompatibilities. - Performance impact of JSON serialization and error-reporting overhead in high-volume logging scenarios. - Whether external agents (e.g., Fluent Bit, Stackdriver agent) are required to forward logs to Google Cloud Logging. ## Package facts - License: The MIT License (MIT) Copyright (c) Jonathan Ballet and contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files… (full text in the JSON record) (unclear) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 414.4K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags google cloud logging formatter, structlog gcp integration, cloud logging json output, gke logging configuration, google cloud error reporting, structured logging gcp, cloud run logging setup, gcp-integration, structured-logging [View on SkillFed](https://skillfed.io/packages/structlog-gcp) · [View on PyPI](https://pypi.org/project/structlog-gcp/)