Skip to main content

No project description provided

Project description

A simple `logging.Handler` subclass to log to a database

# Installation

```python
pip install log2db
```


#Usage

```python
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.1
Filename, size File type Python version Upload date Hashes
Filename, size Log2DB-1.0.1-py3-none-any.whl (7.7 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size Log2DB-1.0.1.tar.gz (6.7 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page