Skip to main content

A Python package for storing application logs in GCP Cloud Logging.

Project description

gcp-lolo

GCP Cloud Logging Python logger

The idea behind this package is to provide the simplest way to log messages to Google Cloud Logging, without having to worry about the details of setting up the Google Cloud Logging client and/or affecting the current application structure.

Installation

pip install gcp-lolo

Usage

Prerequisites

Be sure either one of the following environment variables is set

  • GOOGLE_APPLICATION_CREDENTIALS, pointing to the path of the GCP credentials JSON file
  • GCP_CREDENTIALS_JSON, a string containing the GCP credentials JSON file

Usage method #1

from gcp_lolo import get_gcp_logger

logger = get_gcp_logger('my-logger')

logger.info('This is a test info message')
logger.error('This is a test error message')

Usage method #2

This method will redirect all print and raise statements to the GCP logger, so that you can avoid the need to change your code to use the logger directly.

from gcp_lolo import setup_gcp_logging


setup_gcp_logging('my-logger')

print('This is a test message')

raise Exception('This is a test exception')

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

gcp_lolo-1.0.2.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gcp_lolo-1.0.2-py2.py3-none-any.whl (4.4 kB view details)

Uploaded Python 2Python 3

File details

Details for the file gcp_lolo-1.0.2.tar.gz.

File metadata

  • Download URL: gcp_lolo-1.0.2.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for gcp_lolo-1.0.2.tar.gz
Algorithm Hash digest
SHA256 0126964bcbc33985c54c4e822b2516c3a4a744f84b74325d63137a339fca5110
MD5 15630a1bb6b352f95725502e583b5a21
BLAKE2b-256 db27f0896dec440a86bcfb51c5fe1c4f856a93e024b4f4d39cfe3b72dc4e58db

See more details on using hashes here.

File details

Details for the file gcp_lolo-1.0.2-py2.py3-none-any.whl.

File metadata

  • Download URL: gcp_lolo-1.0.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for gcp_lolo-1.0.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 217f7b7d15054bff0d9be1b3686b4f8df246bd21307907bcc11b80c3edc0dc71
MD5 3b065fee65dd227fff0abc3319ff5804
BLAKE2b-256 54826a678db6f0c6e625b818fa60805be6d62f06ae6de77e10e8b7958627f2ed

See more details on using hashes here.

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