Skip to content

Commit

Permalink
refactor: repackage logger
Browse files Browse the repository at this point in the history
This was previously in a utils module that was not being used for other
tools. It was also missing an __init__.py and was not being properly
exported. This pattern is slightly less verbose.
  • Loading branch information
marvinmarnold committed Oct 5, 2021
1 parent bd4ee84 commit 814b060
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,11 @@ Please note, DIY Hotspots do not earn HNT.
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Pi Supply IoT LoRa Gateway HAT | RPi | DIY-PISLGH | 0.0 | 22 | | | Light | False | Any pi with 40 pin header |
| RAK2287 | RPi | DIY-RAK2287 | 0.0 | 17 | | | Light | False | Any pi with 40 pin header |
## utils

### logger
## logger

```python
from hm_pyhelper.utils import logger
from hm_pyhelper.logger import get_logger
logger = get_logger(__name__)
logger.debug("message to log")
```
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from unittest import TestCase
from hm_pyhelper.utils.logger import get_logger, _log_format
from hm_pyhelper.logger import get_logger, _log_format
import re
import logging


class TestExample(TestCase):
def test_logging(self):
class TestLogger(TestCase):
def test_get_logger(self):
logger = get_logger(__name__)

with self.assertLogs() as captured:
Expand All @@ -20,7 +20,8 @@ def test_logging(self):
# Do not check timestamp and filepath because those change
# based on the environment and run time
expected_partial_output_regex = re.escape(
" - [DEBUG] - test_logger - (test_logger.py).test_logging -- ")
" - [DEBUG] - hm_pyhelper.tests.test_logger -" +
" (test_logger.py).test_get_logger -- ")
expected_output_regex = ".*" + \
expected_partial_output_regex + ".*" + \
" - Hello world."
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

setup(
name='hm_pyhelper',
version='0.8',
version='0.10',
author="Nebra Ltd",
author_email="[email protected]",
description="Helium Python Helper",
Expand Down

0 comments on commit 814b060

Please sign in to comment.