Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use structured logging on GCF with python 3.7 #434

Merged
merged 8 commits into from Nov 1, 2021
9 changes: 1 addition & 8 deletions google/cloud/logging_v2/client.py
Expand Up @@ -16,7 +16,6 @@

import logging
import os
import sys

try:
from google.cloud.logging_v2 import _gapic
Expand Down Expand Up @@ -355,13 +354,7 @@ def get_default_handler(self, **kw):
return AppEngineHandler(self, **kw)
elif monitored_resource.type == _GKE_RESOURCE_TYPE:
return ContainerEngineHandler(**kw)
elif (
monitored_resource.type == _GCF_RESOURCE_TYPE
and sys.version_info[0] == 3
and sys.version_info[1] >= 8
):
# Cloud Functions with runtimes > 3.8 supports structured logs on standard out
# 3.7 should use the standard CloudLoggingHandler, which sends logs over the network.
elif monitored_resource.type == _GCF_RESOURCE_TYPE:
return StructuredLogHandler(**kw, project_id=self.project)
elif monitored_resource.type == _RUN_RESOURCE_TYPE:
return StructuredLogHandler(**kw, project_id=self.project)
Expand Down