Skip to main content

JSON logging setup for Python.

Project description

Documentation Status PyPI Status CI Test Coverage

Introduction

Simple package/script to setup JSON logging for a Python app or script. Uses python-json-logger and is mostly just a wrapper around it. Instead of adding this script to every Python module that I/you create you can just add this as a dependency and call:

from nialog import setup_module_logging, LoggingLevel

# Default logging level is WARNING
setup_module_logging()

# LoggingLevel has enums for default logging module levels
# Can be used with e.g. typer as command-line inputs
LoggingLevel.DEBUG.value == "DEBUG"  # = True

Running tests

To run pytest in currently installed environment:

poetry run pytest

To run test suite best suited for before pushing to e.g. GitHub.

poetry run invoke prepush

To run full extensive test suite:

poetry run invoke test

Formatting and linting

Formatting and linting is done with a single command. First formats, then lints.

poetry run invoke format-and-lint

Building docs

Docs can be built locally to test that ReadTheDocs can also build them:

poetry run invoke docs

Invoke usage

To list all available commands from tasks.py:

poetry run invoke --list

Development

Development dependencies include:

  • invoke

  • nox

  • copier

  • pytest

  • coverage

  • sphinx

Big thanks to all maintainers of the above packages!

License

Copyright © 2021, Nikolas Ovaskainen.

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

nialog-0.0.2.tar.gz (5.2 kB view hashes)

Uploaded Source

Built Distribution

nialog-0.0.2-py3-none-any.whl (4.5 kB view hashes)

Uploaded Python 3

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