Skip to main content

Utility to write logging to influxdb2 in order to gather some application stats. After using this utility, user can create dashboard in Grafana with InfluxDB.

Project description

Logging Utility to Database

Utility to write logging to database in order to gather some application stats.

  • Free software: MIT license

Features

  • Funciton can be extended to different database in future.

  • A helper to log information to InfluxDB2 for further report purpose.

  • The functions here catch the errors, if anything goes wrong it still return and won’t break main program logic. But the information won’t be recorded in InfluxDB.

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

Developer’s Causion

This package is hosted by pypi public. Do not include any sensitive information in this project.

Usage

Install

Installation

pip install coelog2db

Usage:

import logging
from log2db.log2db import Log2DB
from log2db.log2influx import Log2Influx

log2 = Log2DB.get_instance(Log2Influx,conf=conf["influxdb"],user="cronjob")
log2.log(log_level=logging.INFO,message="Loading started") # log this message before acture logic starts

try:
    # main code
    # make sure throw except in your code if you catched them in subprocess

    pass
except Exception as ex:
        log2.log(logging.ERROR,message="download job failed. " + str(ex))

History

0.1.1 (2022-06-01)

  • First release on PyPI.

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

coelog2db-0.3.1.tar.gz (12.1 kB view hashes)

Uploaded Source

Built Distribution

coelog2db-0.3.1-py2.py3-none-any.whl (6.6 kB view hashes)

Uploaded Python 2 Python 3

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