Skip to main content

No project description provided

Project description

A simple logging.Handler subclass to log to a database

Installation

pip install log2db

#Usage

import logging
import os

from log2db import  LogDBHandler

db_path = os.path.abspath('logs.db')
db_handler = LogDBHandler(db_path)

logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
logger.addHandler(db_handler)

logger.info('This is going to be saved in a db')

The level of LogDBHandler can be set with the level argument in the constructor.

The handler saves the following properties of the logRecord:

  • logRecord.levelname
  • logRecord.levelno
  • logRecord.pathName
  • logRecord.funcName
  • logRecord.lineno
  • logRecord.created
  • logRecord.msg

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for Log2DB, version 1.0.2
Filename, size File type Python version Upload date Hashes
Filename, size Log2DB-1.0.2-py3-none-any.whl (7.8 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size Log2DB-1.0.2.tar.gz (6.7 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page