From cc1f2ee298fec9a690021f9460886ed30ffe0142 Mon Sep 17 00:00:00 2001 From: Zobayer Hasan Date: Sat, 29 May 2021 06:16:32 +0600 Subject: [PATCH] Restructure modules --- CHANGELOG.rst | 7 ++ README.md | 89 +++++++++++---------- docs/conf.py | 2 +- docs/snippets/logging.yaml | 2 +- logging_/__init__.py | 3 - logging_/handlers/queue_listener_handler.py | 2 +- tests/test_logger.py | 2 +- 7 files changed, 57 insertions(+), 50 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 838b5a8..3ee7c39 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,3 +1,10 @@ +v0.1.1-beta (2021-05-29) +++++++++++++++++++++++++ + +Changes + +* Move ``QueueListenerHandler`` under ``handlers`` package. + v0.1.0-beta (2021-05-29) ++++++++++++++++++++++++ diff --git a/README.md b/README.md index 312b5e8..260545f 100644 --- a/README.md +++ b/README.md @@ -15,20 +15,14 @@ Documentation ------------- [https://logging-extras.readthedocs.io/en/latest/](https://logging-extras.readthedocs.io/en/latest/) -Distribution +Installation ------------ -To create a source and wheel distribution, run: - - python -m pip install wheel - python setup.py clean sdist bdist_wheel - -It is recommended to use a virtualenv. +Install [logging-extras](https://pypi.org/project/logging-extras/) using pip -Installation ------------- + pip install logging-extras -Download the latest binary or source package from github [logging-extras releases](https://github.com/zobayer1/logging-extras/releases) +Alternatively, download the latest binary or source package from [github](https://github.com/zobayer1/logging-extras/releases) Install wheel package with `pip`: @@ -42,36 +36,8 @@ Install source package as editable: Please refer to documentation pages for available modules. -Development ------------ - -Additional development and documentation dependencies can be installed using extras. It is recommended to use a virtualenv. - -### Use Pre-Commit Hooks - -Install pre-commit hooks and dependencies: - - pip install -e .[dev] - pre-commit install - pre-commit autoupdate - pre-commit run --all-files - -### Run Tests - -Run tests from the source with Pytest: - - pip install -e .[dev] - pytest -s - -### Generate Documentation - -Generate documentation from the source with Sphinx: - - pip install -e .[docs] - cd docs - mkdir -p _static _templates - make html - python -m http.server --directory build/html +Module Index +============ QueueListenerHandler -------------------- @@ -100,7 +66,7 @@ handlers: filename: 'test_logger.log' formatter: simple queue_handler: - class: logging_.QueueListenerHandler + class: logging_.handlers.QueueListenerHandler handlers: - cfg://handlers.console - cfg://handlers.file_handler @@ -141,6 +107,43 @@ logger.error("This is an error log") logger.critical("This is a critical log") ``` -### Sources +Development +----------- + +Additional development and documentation dependencies can be installed using extras. It is recommended to use a virtualenv. + +### Use Pre-Commit Hooks + +Install pre-commit hooks and dependencies: + + pip install -e .[dev] + pre-commit install + pre-commit autoupdate + pre-commit run --all-files + +### Run Tests + +Run tests from the source with Pytest: + + pip install -e .[dev] + pytest -s + +### Generate Documentation + +Generate documentation from the source with Sphinx: + + pip install -e .[docs] + cd docs + mkdir -p _static _templates + make html + python -m http.server --directory build/html + +### Create Distribution Packages + +To create a source and wheel distribution, run: + + git clone git@github.com:zobayer1/logging-extras.git + python -m pip install wheel + python setup.py clean sdist bdist_wheel -1. `QueueListenerHandler` was inspired by [Rob Blackbourn's implementation](https://rob-blackbourn.medium.com/how-to-use-python-logging-queuehandler-with-dictconfig-1e8b1284e27a). +**Note:** This project uses `setuptools-scm` to generate build versions from git tags. Build system will raise errors if you are trying to build packages outside a git repo. diff --git a/docs/conf.py b/docs/conf.py index 744af64..cb46cea 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -23,7 +23,7 @@ author = "Zobayer Hasan" # The full version, including alpha/beta/rc tags -release = "v0.1.0-beta" +release = "v0.1.1-beta" source_suffix = ".rst" master_doc = "index" diff --git a/docs/snippets/logging.yaml b/docs/snippets/logging.yaml index e771d52..bfc5177 100644 --- a/docs/snippets/logging.yaml +++ b/docs/snippets/logging.yaml @@ -16,7 +16,7 @@ handlers: filename: 'test_logger.log' formatter: simple queue_handler: - class: logging_.QueueListenerHandler + class: logging_.handlers.QueueListenerHandler handlers: - cfg://handlers.console - cfg://handlers.file_handler diff --git a/logging_/__init__.py b/logging_/__init__.py index 2087120..40a96af 100644 --- a/logging_/__init__.py +++ b/logging_/__init__.py @@ -1,4 +1 @@ # -*- coding: utf-8 -*- -from logging_.handlers import QueueListenerHandler - -_all_ = ["QueueListenerHandler"] diff --git a/logging_/handlers/queue_listener_handler.py b/logging_/handlers/queue_listener_handler.py index f69e71d..b0ccefb 100644 --- a/logging_/handlers/queue_listener_handler.py +++ b/logging_/handlers/queue_listener_handler.py @@ -32,7 +32,7 @@ class QueueListenerHandler(QueueHandler): filename: 'config_test.log' formatter: simple queue_handler: - class: logging_.QueueListenerHandler + class: logging_.handlers.QueueListenerHandler handlers: - cfg://handlers.console - cfg://handlers.file_handler diff --git a/tests/test_logger.py b/tests/test_logger.py index 60fdbeb..607fc7e 100644 --- a/tests/test_logger.py +++ b/tests/test_logger.py @@ -23,7 +23,7 @@ filename: 'test_logger.log' formatter: simple queue_handler: - class: logging_.QueueListenerHandler + class: logging_.handlers.QueueListenerHandler handlers: - cfg://handlers.console - cfg://handlers.file_handler