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 fileGCP_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
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 gcp_lolo-1.0.1.tar.gz.
File metadata
- Download URL: gcp_lolo-1.0.1.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a6266daf5f3a0c079f114c3ef248fc6e7162ccad18456632020155410107547
|
|
| MD5 |
79e53a5a83e6897863ce1b9fcb6526ca
|
|
| BLAKE2b-256 |
b51386d701a323a5c23d27c768c72e159b117105b939b392734b1c117d7b4078
|
File details
Details for the file gcp_lolo-1.0.1-py2.py3-none-any.whl.
File metadata
- Download URL: gcp_lolo-1.0.1-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d39a714bc9c881c75f95c9074a56e6e45d7bbafefd8664bf2c50ea6a55708c7
|
|
| MD5 |
6dc38e9519533c4efdfa5008665d9539
|
|
| BLAKE2b-256 |
4fd723f4b2192466b0fdb29207eb58d9e3ab02713cad63b43f038178cdc3d0de
|