Nameko extension exposing a structlog dependency injector
Project description
Structlog as nameko extension
Free software: Apache Software License 2.0
Extension for nameko that replaces python logging module with structlog.
Installation
To install nameko-structlog, simply use pip.
pip install nameko-structlog
# to enable coloring during development
pip install nameko-structlog[colors]
Usage
Add Structlog log level to your nameko config file:
# config.yml
STRUCTLOG:
DEVELOPMENT_MODE: ${DEV:false}
WORKER_NAME: ${WORKER_NAME:false}
...
Include the StructlogDependency dependency in your service class:
# service.py
from nameko.rpc import rpc
from nameko_structlog import StructlogDependency
class MyService(object):
name = 'demo'
log = StructlogDependency()
@rpc
def my_method(self, name):
self.log.info('Your name is '.format(name))
Run your service, providing the config file:
$ nameko run service --config config.yaml
Credits
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
History
0.1.0 (2018-10-25)
First release on Vermantia 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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
File details
Details for the file nameko_structlog-0.1.0-py2.py3-none-any.whl
.
File metadata
- Download URL: nameko_structlog-0.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 215524d634eba51347e0f51ba64b72a12e4e1f95915104e6b9a56aeaeca9d449 |
|
MD5 | 7ea32db16659f2700a8da76ec054979d |
|
BLAKE2b-256 | f6fc0eae4553b87997af9bd1529c23210efbc9ab2efc3496c4395ec2e9e6bb87 |