Skip to main content

Pyramid plugin for YAML logging configuration.

Project description

Pyramid Sawing

A Pyramid framework plugin for configurating logging via YAML. This uses the Python standard-library’s logging (initialized using logging.config.dictConfig).

Usage

Include the package in your project, either by adding to the INI configuration:

pyramid.includes = pyramid_sawing
pyramid_sawing.file = my-logging-config.yaml

Or declarative via the configuration object:

config.include('pyramid_sawing')
assert 'pyramid_sawing.file' in config.registry.settings

You’ll be required to specify a logging configuration file at pyramid_sawing.file, which points to the file that contains your YAML logging configuration.

YAML Configuration

This configuration follows the standard-library’s logging.config dictionary schema

An example configuration might look like this:

###
# logging configuration
###
version: 1

formatters:
  generic:
    format    : '%(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s'
  papertrail:
    format    : '%(asctime)s %(hostname)s my_project %(message)s'
    datefmt   : '%Y-%m-%dT%H:%M:%S'
filters:
  context:
    ()        : pyramid_sawing.filters.ContextFilter
handlers:
  console:
    class     : logging.StreamHandler
    level     : NOTSET
    formatter : generic
    stream    : 'ext://sys.stdout'
  syslog:
    class     : logging.handlers.SysLogHandler
    level     : DEBUG
    formatter : papertrail
    filters   : [context]
    address   : ['<host>.papertrailapp.com', 11111]
loggers:
  my_project:
    level     : INFO
    handlers  : [console, syslog]
    propagate : 0
root:
  level       : NOTSET
  handlers    : []

A typical gotcha in configuring this is to forget the ‘version’. Please make sure you include version: 1 in your configuration.

License

This software is subject to the provisions of the GNU Affero General Public License Version 3.0 (AGPL). See LICENSE.txt for details. Copyright (c) 2015 Rice University

Change Log

1.0.0

  • Add a logging filter that allows for %(hostname)s be be used within log lines. [pumazi]

  • Logging from a YAML file. [pumazi]

Project details


Download files

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

Source Distributions

pyramid_sawing-1.0.0.zip (22.1 kB view details)

Uploaded Source

pyramid_sawing-1.0.0.tar.gz (16.2 kB view details)

Uploaded Source

pyramid_sawing-1.0.0.tar.bz2 (15.0 kB view details)

Uploaded Source

File details

Details for the file pyramid_sawing-1.0.0.zip.

File metadata

  • Download URL: pyramid_sawing-1.0.0.zip
  • Upload date:
  • Size: 22.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pyramid_sawing-1.0.0.zip
Algorithm Hash digest
SHA256 9f28a1fbdc4563efd60bc6b38a24b4fc2452622d5864d431589068a89a284481
MD5 dfdb69635c27134aa2e89f8204688c04
BLAKE2b-256 29f046ddef7e76b97d47d298dedd9d01f4843b8a89629ba7759f8602a2acbdeb

See more details on using hashes here.

Provenance

File details

Details for the file pyramid_sawing-1.0.0.tar.gz.

File metadata

File hashes

Hashes for pyramid_sawing-1.0.0.tar.gz
Algorithm Hash digest
SHA256 bb83d5704de44d9cf8f26b2e4095a6b17927ab91c5f02670788eb7300f724b60
MD5 5f35b18722d26b3c6aa92003d00b2a5d
BLAKE2b-256 8a3c487bcdb0a9d967fd236b34898961b84f6187d4a8d4129c3cd6533fff59a0

See more details on using hashes here.

Provenance

File details

Details for the file pyramid_sawing-1.0.0.tar.bz2.

File metadata

File hashes

Hashes for pyramid_sawing-1.0.0.tar.bz2
Algorithm Hash digest
SHA256 38dd782fb73b4caa225aee4142d31b528217b5c0cb2941dd8aecf3fe934f8234
MD5 c43d73e0f50ab2b509cd4db2f62012c9
BLAKE2b-256 5ee20dbf6405e7402730a61b8b590391c769f76fe5819035e2f1f1d10a620804

See more details on using hashes here.

Provenance

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