Skip to main content

Logging handler to send the logs to Google Chat (GChat) room/space.

Project description

GChat Logging Handler

Logging handler to send the logs to Google Chat (GChat) room/space.

Installation

Install with pip:

$ pip install gchat-logging-handler

Features

  • Push logs to google chat using the webhook url
  • Send a message to google chat using a simple CLI command (also using webhook)

Usage/Examples

In code

import logging

from gchat_logging_handler import GChatHandler


logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
gchat_handler = GoogleChatHandler(
    webhook_url="https://chat.googleapis.com/v1/spaces/XXXXXXXXX"
)
gchat_handler.setLevel(logging.ERROR)
logger.addHandler(gchat_handler)

logger.debug("DEBUG - not in gchat")
logger.info("INFO - not in gchat")
logger.error("ERROR - in gchat")

CLI Command

$ python -m gchat_logging_handler \
    "https://chat.googleapis.com/v1/spaces/XXXXXXXXX" \
    "Sending via CLI"

License

BSD 3-Clause

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

gchat_logging_handler-0.0.1.dev0.tar.gz (3.4 kB view hashes)

Uploaded Source

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page