A package to register GCP loggings
Project description
GCP LOGGING MANAGER
This is a simple gcp logging package where you can easily write logs to gcp stackdriver with custom parameters.
Required library
pip install --upgrade google-cloud-logging
Setting up authentication
- In the Cloud Console, go to the Create service account key page.
- From the Service account list, select New service account.
- In the Service account name field, enter a name.
- From the Role list, select Project > Owner.
GCP Stackdriver 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) default value region='us-east1'
Sample code
from santodigital_gcpLogging import CloudRunLoggingClient
# Resouce must match with strackdriver 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
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 santodigital-gcpLogging-0.0.4.tar.gz.
File metadata
- Download URL: santodigital-gcpLogging-0.0.4.tar.gz
- Upload date:
- Size: 2.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3fbfd81bfc51598c068575ecbcc325ee03b9b0ffdaa2d9fad3f777d98bdf4262
|
|
| MD5 |
15eee6093da764cf7f884223d098d5b0
|
|
| BLAKE2b-256 |
c18c8495c82f8207bf0156d110fa25574290c038521bd2c364739105f14b292d
|
File details
Details for the file santodigital_gcpLogging-0.0.4-py3-none-any.whl.
File metadata
- Download URL: santodigital_gcpLogging-0.0.4-py3-none-any.whl
- Upload date:
- Size: 3.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b3d4ec95e6d5444dc133ae45dc8835a475dfa7c803e3c59023ae1c9dbf0b4fbf
|
|
| MD5 |
5fb127f3aeb49300a54277feecee5e5b
|
|
| BLAKE2b-256 |
74621bd84514b8b7144ab98ccf921c2d450ddf3aa396b34ef1c3c98a27b99be1
|