Skip to main content

Custom Logger CloudCity

To unify the way we log and alert to Google Cloud Logger and Sentry, we have created this package.

Changelog

1.0.2 Removed the explicit requirement of havint the CLOUD_LOGGER_NAME environment var set. When none is set, fall back on the default logger

Example

How to use:

  1. Include the package in your project by doing pip install custom-logger-cloudcity
  2. Simply import the module!

Below is an examlpe how to use

import os

os.environ.update({"GOOGLE_APPLICATION_CREDENTIALS": "{Location to you Service account key}"})
os.environ.update({"CLOUD_LOGGER_NAME": "nice_test_logger"})  # Give a name the app will log to
os.environ.update({"ENV": "development"})
# We need to set the environment vars before importing the custom_logger
# You can do so as this example or just set it in the machine wide environment
from custom_logger import custom_logger

if __name__ == '__main__':
    # A message as a string will end up in as a textPayload in Google Cloud Logging
    custom_logger.info("Hello My Friend")
    # Below will not be logged to Google Cloud Logging
    custom_logger.error("not ok")
    # A message as an argument will end up in as a jsonPayload in Google Cloud Logging
    custom_logger.info(some_message="This is a test log in a jsonPayload")
    # # An example with multiple arguments
    custom_logger.info(
        some_message="This is a test log in a jsonPayload",
        more_info="It has more info",
        and_even_more="These can all be metrics and stuff",
        but="We need to make sure that we catch the logging exceptions and print the whole lot",
    )
    # With message overwrite
    custom_logger.info(
        message="Let's overwrite the message node",
        some_message="This is a test log in a jsonPayload",
        more_info="It has more info",
        and_even_more="These can all be metrics and stuff",
        but="We need to make sure that we catch the logging exceptions and print the whole lot",
    )
    # You can even nest data, as this is stored as a struct in Google Cloud Logging
    custom_logger.info(message="This is message overwrite", amount_transfered=10, amount_failed=10,
                       errors=["a", "b", "c"])

Metadata

Release files for custom-logger-cloudcity 1.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for custom-logger-cloudcity 1.0.4
File Size Uploaded Provenance Actions
custom-logger-cloudcity-1.0.4.tar.gz 2.8 kB Without provenance Details for custom-logger-cloudcity-1.0.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for custom-logger-cloudcity 1.0.4
File Interpreter ABI Platform Actions
custom_logger_cloudcity-1.0.4-py3-none-any.whl Python 3 none any Details for custom_logger_cloudcity-1.0.4-py3-none-any.whl

Total release size: 6.0 kB

Release files / custom-logger-cloudcity-1.0.4.tar.gz

Download URL custom-logger-cloudcity-1.0.4.tar.gz
Size 2.8 kB
Tags Source
SHA-256 checksum
How to use checksums
3884f0f4267a6f9c7c2e0fe5805ce54bd6768e4655b655c01ff0a247e2fa065d
BLAKE2b-256 checksum
How to use checksums
9636c77d6d72fe4cda9bfb0a0686672e65b194d473d096b7a0541cfc1923ba5b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

Release files / custom_logger_cloudcity-1.0.4-py3-none-any.whl

Download URL custom_logger_cloudcity-1.0.4-py3-none-any.whl
Size 3.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
73e5cdb225e7fad76b7c859de0eec3914607a7523bd8014187c45ed571cf5197
BLAKE2b-256 checksum
How to use checksums
f6a4528d3283882efaf76c051b6d08f9f5e0559d71550cbe2fa6da02beae6935
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

Security for custom-logger-cloudcity 1.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page