Skip to content

Commit

Permalink
Restructure modules
Browse files Browse the repository at this point in the history
  • Loading branch information
zobayer1 committed May 29, 2021
1 parent cb5c557 commit cc1f2ee
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 50 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
v0.1.1-beta (2021-05-29)
++++++++++++++++++++++++

Changes

* Move ``QueueListenerHandler`` under ``handlers`` package.

v0.1.0-beta (2021-05-29)
++++++++++++++++++++++++

Expand Down
89 changes: 46 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`:

Expand All @@ -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
--------------------
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 [email protected]: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.
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion docs/snippets/logging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions logging_/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
# -*- coding: utf-8 -*-
from logging_.handlers import QueueListenerHandler

_all_ = ["QueueListenerHandler"]
2 changes: 1 addition & 1 deletion logging_/handlers/queue_listener_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/test_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cc1f2ee

Please sign in to comment.