Skip to main content
README
======

This package is meant to be used to setup logging to the database from a pyramid application.
To include in a pyramid application you need to alter the development.ini/production.ini files.

EXAMPLE INI FILE
================

[loggers]
keys = root, myapp

[handlers]
keys = console, sqlalchemy

[formatters]
keys = generic

[logger_root]
level = INFO
handlers = console

[logger_myapp]
level = DEBUG
handlers = sqlalchemy
qualname = myapp

[handler_sqlalchemy]
class = logservice.handlers.sqlalchemy_handler.SQLAlchemyHandler
args = ()
level = NOTSET
formatter = generic

[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic

[formatter_generic]
format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s


You will also want to create an initialize_log_db.py file in your scripts folder

EXAMPLE initialize_log_db.py
============================

import os
import sys
from logservice.scripts import initializedb

from pyramid.paster import (
get_appsettings,
setup_logging,
)

from pyramid.scripts.common import parse_vars


def usage(argv):
cmd = os.path.basename(argv[0])
print('usage: %s <config_uri> [var=value]\n'
'(example: "%s development.ini")' % (cmd, cmd))
sys.exit(1)


def main(argv=sys.argv):
if len(argv) < 2:
usage(argv)
config_uri = argv[1]
options = parse_vars(argv[2:])
setup_logging(config_uri)
settings = get_appsettings(config_uri, options=options)
log = initializedb.InitializeDb(settings['sqlalchemy.url'])
log.initialize_db()


EXAMPLE setup.py change
=======================

entry_points = """\
[paste.app_factory]
main=myapp:main
[console_scripts]
initialize_log_db = myapp.scripts.initialize_log_db:main
""",

Release files for PyramidLogService 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for PyramidLogService 0.1
File Size Uploaded
PyramidLogService-0.1.tar.gz 3.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for PyramidLogService 0.1
File Interpreter ABI Platform
PyramidLogService-0.1-py3.5.egg Legacy Egg format - - Details

Total release size: 16.7 kB

Release files / PyramidLogService-0.1.tar.gz

Download URL PyramidLogService-0.1.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
16395f6f9b925a4b4debde20904df0e06487fba9af181ec543713e7c1a734f4e
BLAKE2b-256 checksum
How to use checksums
e00709de8aa35f3847899a5dc2a6a3f2306e6bb1302e16d82bee7db2a572f505
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / PyramidLogService-0.1-py3.5.egg

Download URL PyramidLogService-0.1-py3.5.egg
Size 12.9 kB
Tags Egg
SHA-256 checksum
How to use checksums
205dc9269eb862a54e75cf0c037c4aedad0988ef2eabd977ba12cddcdaf1b516
BLAKE2b-256 checksum
How to use checksums
ea6162b71e4f357c07f9c643bb33f52dabcf999decbdfe6787649dbd5b4acaf8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page