Skip to main content

Your project description goes here

Project description

https://badge.fury.io/py/frame_logging.svg https://travis-ci.org/ItsfBisounours/frame_logging.svg?branch=master https://codecov.io/gh/ItsfBisounours/frame_logging/branch/master/graph/badge.svg

Your project description goes here

Documentation

The full documentation is at https://frame_logging.readthedocs.io.

Quickstart

  1. Install Frame Logging:

    pip install frame_logging
  2. Add it to your INSTALLED_APPS:

INSTALLED_APPS = (
    ...
    'frame_logging.apps.FrameLoggingConfig',
    ...
)
  1. Create a class to format your extra logging kwargs

#

class FrameFormatterExample(FrameFormatter):

    # format methods

    @classmethod
    def get_format_behaviour(cls):
        return OrderedDict([
            ('customer_id', cls.format_customer_id),
        ])

    @classmethod
    def format_customer_id(cls, customer_id):
        return "customer_id={}".format(customer_id)

    # then if you need to, you can add new method to transform extra kwargs
    # transform methods

    @classmethod
    def get_transform_kwargs_methods(cls):
        return   {
            'order': cls.transform_order,
        }

    @classmethod
    def transform_order(cls, order, **kwargs):
        kwargs['customer_id'] = order.customer['id']
        return kwargs
  1. Configure frame loggin in your settings.py

# mandatory, if you do not priovide a formatter the app will crash
FRAME_FORMATTER=FrameFormatterExample()

# optionnal, default = ' - '
FRAME_SEPARATOR='+'
  1. Use it:

import frame_logging.log as log

class Order(object):
    def __init__(self):
        self.customer = {'id': 1}

log.info('Renewed contract %s', 'test', order=order)
# 'Renewed contract test - customer_id=1'))

Features

  • TODO

Running Tests

Does the code actually work?

source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install tox
(myenv) $ tox

Credits

Tools used in rendering this package:

History

0.1.0 (2017-10-26)

  • First release on PyPI.

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

frame_logging-0.2.1.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

frame_logging-0.2.1-py2.py3-none-any.whl (7.1 kB view details)

Uploaded Python 2Python 3

File details

Details for the file frame_logging-0.2.1.tar.gz.

File metadata

  • Download URL: frame_logging-0.2.1.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for frame_logging-0.2.1.tar.gz
Algorithm Hash digest
SHA256 7bb97faf0da1535a44dcd6ae29d5a4e91177642b0d673da11904f6ea442ec97f
MD5 556391696e5a0a08f76e4cdb4ae30be7
BLAKE2b-256 4b8be60c1c7aaa8475ee33227c02f472500e739bc5a9bbe60978e70d511de90b

See more details on using hashes here.

File details

Details for the file frame_logging-0.2.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for frame_logging-0.2.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 69c701e8862be9d9977cfe9eefa7020795791360605ad7906fe7389c65f5a3ae
MD5 89be9097f66812e317924818edf3814d
BLAKE2b-256 387d43e6a00e443e0595609562a7dcf689450371ae0d76a2fdc15d8723a7c3fe

See more details on using hashes here.

Supported by

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