1 file was added to this release more than 14 days after its initial publication. Inspect the release files before installing.
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.
Additional Features
Transit Logging
This resembles the functionality you would find in pyramid_translogger except that this implementation is more configurable.
To enable this feature, add the following line to your configuraton/settings.
pyramid_sawing.transit_logging.enabled? = yes # Optional... # The default logger_name is `transit_logger` pyramid_sawing.transit_logging.logger_name = lumberjack
A template for configuring the transit logger would be something like:
formatters:
apache_style:
# filters : [environ]
format : '%(REMOTE_ADDR)s - %(REMOTE_USER)s [%(asctime)s] "%(REQUEST_METHOD)s %(REQUEST_URI)s %(HTTP_VERSION)s" %(status)s %(bytes)s "%(HTTP_REFERER)s" "%(HTTP_USER_AGENT)s"'
datefmt : '%d/%b/%Y:%H:%M:%S'
filters:
environ:
() : pyramid_sawing.filters.EnvironFilter
handlers:
console:
class : logging.StreamHandler
formatter : apache_style
filters : [environ]
stream : 'ext://sys.stdout'
loggers:
transit_logger:
handlers : [console]
propagate : 0
This should give you the exact same output as pyramid_translogger.
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.1.3
Adjust the transit logging tween to set and return the response attribute of the request object.
Fix tests for Python3 compatiblity.
1.1.2
Fix the transit logging tween to return the response coming from the handler rather than the one attached to the request object. [pumazi]
1.1.1
Fix the transit logging tween by returning the response, which caused secondary tweens and event subscribers to fail. [pumazi]
1.1.0
Add a transit (request) logging feature that mimics functionality found in pyramid_translogger. [pumazi]
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]
Metadata
Release files for pyramid-sawing 1.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
File added late
1 file was uploaded more than 14 days after the first file in this release.
While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.
We recommend inspecting the release files before installing.
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyramid_sawing-1.1.3-py3-none-any.whl | Python 3 | none | any | Details |
| pyramid_sawing-1.1.3-py2-none-any.whl | Python 2 | none | any | Details |
Total release size: 30.6 kB
Release files / pyramid_sawing-1.1.3-py3-none-any.whl
File added late
This file was uploaded more than 14 days after the first file in this release.
While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.
We recommend inspecting the release file before installing.
| Download URL | pyramid_sawing-1.1.3-py3-none-any.whl |
|---|---|
| Size | 20.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
67404c8b0215059451f1c0e3f1a33cab8aa03cefee9c5fb1a2dc290f631910e0
|
|
BLAKE2b-256 checksum How to use checksums |
a9607a08e624d497f9a927400fae71de4f02c497933aba78ef46d5fb6325ea19
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.3.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5
|
Release files / pyramid_sawing-1.1.3-py2-none-any.whl
| Download URL | pyramid_sawing-1.1.3-py2-none-any.whl |
|---|---|
| Size | 10.7 kB |
| Tags | Python 2 |
|
SHA-256 checksum How to use checksums |
30378ed4af968edcd133930d6dc5dacb7469b3753176ce40033ef0f6c312b225
|
|
BLAKE2b-256 checksum How to use checksums |
228e279e3860e9d38f4a458ab7e318abce6d3bb3d77a7c4520bef609f71df743
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |