Wrapper around Google Cloud Platform (GCP) logging library to simplify creation of traced logs.
Project description
Introduction
This project provides easy to use wrapper around the Google Cloud Platform logging library to simplify creation of the traced logs.
Quick Start
from surquest.GCP.logger import Logger
# request is an object which allows to check the request headers
# request.headers.get('X-Cloud-Trace-Context', None)
request = None
logger = Logger(request=request)
logger.log(
severity="INFO",
msg="This is a test message", # log message
**{ # context information as KWARGS
"key1": "value1",
"key2": "value2"
}
)
# Alternatively you can set the severity via the method name
logger.debug(msg="This is a DEBUG message")
logger.info(msg="This is a INFO message")
logger.warning(msg="This is a WARNING message")
logger.error(msg="This is a ERROR message")
logger.critical(msg="This is a CRITICAL message")
Local development
You are more than welcome to contribute to this project. To make your start easier we have prepared a docker image with all the necessary tools to run it as interpreter for Pycharm or to run tests.
Build docker image
docker build `
--tag surquest/gcp/logger `
--file package.base.dockerfile `
--target test .
Run tests
docker run --rm -it `
-v "${pwd}:/opt/project" `
-e "GOOGLE_APPLICATION_CREDENTIALS=/opt/project/credentials/keyfile.json" `
-w "/opt/project/test" `
surquest/gcp/logger pytest
Project details
Release history Release notifications | RSS feed
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
File details
Details for the file surquest_gcp_logger-0.0.1rc4.tar.gz
.
File metadata
- Download URL: surquest_gcp_logger-0.0.1rc4.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a3f52dbb53a69b910633216fac57a476cca2559c6ef1949f050957b7da95e970 |
|
MD5 | 2c0dc1216f5bcf67c937de1d803c1e0f |
|
BLAKE2b-256 | ea4d6b3652907c69cb3a755e59db22e226710d44b3124b1eadc7a4bc85a5a9cc |
File details
Details for the file surquest_gcp_logger-0.0.1rc4-py2.py3-none-any.whl
.
File metadata
- Download URL: surquest_gcp_logger-0.0.1rc4-py2.py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 738c67e9f8c0a0f144172b21a55e5dc2070ecad9e78769bc6eed00834a8941de |
|
MD5 | 47d06953185f33854f984f436b2b1514 |
|
BLAKE2b-256 | 7276e5c45983a53eee6d22b56107bbaf49b22641939c12dbf5427ea8dc9a3b3a |