Skip to main content

A package to register GCP loggings

Project description

GCP LOGGING MANAGER Package

This is a simple gcp logging package where you can easily write logs to gcp stackdriver with custom parameters.

GCP stack driver matrics

param type: Resource type to filter in Stackdriver Logging (required) param service: Service name to filter in Stackdriver Logging (required) param log_name: Log Name to filter in Stackdriver Logging param region: GCP Service Region to filter in Stackdriver Logging (optional) if not provided will take default value region='us-east1'

Sample code

from  santodigital_gcpLogging import CloudRunLoggingClient

# Resouce must match with strack driver resource.type (cloud_run_revision or bigquery_resource etc)
resource = 'cloud_run_revision'
name = 'santodigital-gcpLogging'
SERVICE = 'santodigital-gcpLogging'
logger = CloudRunLoggingClient(resource, SERVICE, name)

"""
:param struct: (Dict) Custom information for logging into Stackdriver Logging.
:param severity: Severity Level for the logging.
"""
def report(struct, severity='INFO'):
    logger.report(struct, severity)
    return True

if __name__ == '__main__':
    print(report({'info':'success'}, 'WARNING'))

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

santodigital-gcpLogging-0.0.2.tar.gz (2.0 kB view hashes)

Uploaded Source

Built Distribution

santodigital_gcpLogging-0.0.2-py3-none-any.whl (3.4 kB view hashes)

Uploaded Python 3

Supported by

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