Skip to main content

UNKNOWN

Project description

Install

Grab the code with pip:

$ pip install logtopg

But you also have to install the ltree contrib module into your database:

$ sudo -u postgres psql -c "create extension ltree";

Try it out

Here’s an example script:

import logging
import logging.config

log = logging.getLogger("logtopg.example")

if __name__ == "__main__":

    # These need to be correct, so you'll likely need to change them.
    db_credentials = {
        "database":"logtopg",
        "host":"localhost",
        "user":"logtopg",
        "password":"l0gt0pg"}

    d = dict({
        'disable_existing_loggers': False,

        'handlers': {

            'pg': {
                'class': 'logtopg.PGHandler',
                'level': 'DEBUG',
                'log_table_name': 'logtopg_example',

                'params': db_credentials},

            "console": {
                "class": "logging.StreamHandler",
                "level": "DEBUG"
            }},

        'root': {
            'handlers': ["console", 'pg'],
            'level': 'DEBUG'},

        'version': 1})

    logging.config.dictConfig(d)

    log.debug("debug!")
    log.info("info!")
    log.warn("warn!")
    log.error("error!")
    log.critical("critical!")

Run the tests

Create the test user and database:

$ sudo -u postgres createuser --pwprompt logtopg
$ sudo -u postgres createdb --owner logtopg logtopg
$ sudo -u postgres psql -c "create extension ltree";

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

LogToPG-0.0.1.tar.gz (2.2 kB view details)

Uploaded Source

File details

Details for the file LogToPG-0.0.1.tar.gz.

File metadata

  • Download URL: LogToPG-0.0.1.tar.gz
  • Upload date:
  • Size: 2.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for LogToPG-0.0.1.tar.gz
Algorithm Hash digest
SHA256 e69fdea34680e67cd5c81643b34e0e085dbc62e4dc441b0ac34757cd36e12f43
MD5 2f864ea50f2598d985c4fed26eede382
BLAKE2b-256 0dd4fa330955dfcbcaaf6fc8db51b8defba10a67285c9f73c4402ee1c7f06107

See more details on using hashes here.

Supported by

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