|
|
|
@@ -0,0 +1,107 @@
|
|
|
|
|
Metadata-Version: 2.1
|
|
|
|
|
Name: eh_logging
|
|
|
|
|
Version: 0.1.5
|
|
|
|
|
Summary: Simple helper to get easier formatted logger from the python logging module
|
|
|
|
|
Home-page: https://git.eishausener.dev/Eishausener/eh_logging
|
|
|
|
|
Author: Eishausener <code@eishausener.de>
|
|
|
|
|
Author-email: code@eishausener.de
|
|
|
|
|
License: MIT
|
|
|
|
|
Project-URL: issue tracker, https://git.eishausener.dev/Eishausener/eh_logging/issues
|
|
|
|
|
Classifier: License :: OSI Approved :: MIT License
|
|
|
|
|
Description-Content-Type: text/markdown
|
|
|
|
|
Provides-Extra: dev
|
|
|
|
|
Requires-Dist: twine; extra == "dev"
|
|
|
|
|
Requires-Dist: wheel; extra == "dev"
|
|
|
|
|
Requires-Dist: setuptools; extra == "dev"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# eh_logging
|
|
|
|
|
|
|
|
|
|
> Simple helper to get easier formatted logger from the python logging module
|
|
|
|
|
|
|
|
|
|
# install
|
|
|
|
|
|
|
|
|
|
pip install git+https://git.eishausener.dev/Eishausener/eh_logging \
|
|
|
|
|
or \
|
|
|
|
|
pip install git+https://github.com/Eishausener/eh_logging
|
|
|
|
|
|
|
|
|
|
# usage
|
|
|
|
|
|
|
|
|
|
import eh-logging, create a formatted logger and use the logger
|
|
|
|
|
|
|
|
|
|
```python
|
|
|
|
|
# import
|
|
|
|
|
import eh_logging as logging
|
|
|
|
|
|
|
|
|
|
# create formatted logger
|
|
|
|
|
formatted_logger = logging.get_formatted_logger(
|
|
|
|
|
'formatted_logger',
|
|
|
|
|
console=True,
|
|
|
|
|
console_level=logging.DEBUG,
|
|
|
|
|
file=True,
|
|
|
|
|
file_path=r'log\formatted_logger.log',
|
|
|
|
|
file_level=logging.DEBUG,
|
|
|
|
|
file_backup_count=5,
|
|
|
|
|
file_rotate='h',
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# use the logger
|
|
|
|
|
formatted_logger.debug('Example formatted DEBUG Message')
|
|
|
|
|
formatted_logger.info('Example formatted INFO Message')
|
|
|
|
|
formatted_logger.warning('Example formatted WARNING Message')
|
|
|
|
|
formatted_logger.error('Example formatted ERROR Message')
|
|
|
|
|
formatted_logger.critical('Example formatted CRITICAL Message')
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
use the decorator with the INFO level
|
|
|
|
|
|
|
|
|
|
```python
|
|
|
|
|
# import
|
|
|
|
|
import eh_logging as logging
|
|
|
|
|
|
|
|
|
|
# set default logger to DEBUG level to see output
|
|
|
|
|
logging.set_default_level(logging.DEBUG)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# use logging decorator with default logger
|
|
|
|
|
@logging.Decorator.info(arg=True, kwarg=True, return_value=True, decimal_places=1)
|
|
|
|
|
def example_function(first_param, second_param, *args, **kwargs):
|
|
|
|
|
return first_param, second_param, *args, *kwargs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# execute function
|
|
|
|
|
example_function('Hello', 'world', 'test', 'example', hello='world', world='test')
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
use the decorator with own logger
|
|
|
|
|
|
|
|
|
|
```python
|
|
|
|
|
# import
|
|
|
|
|
import eh_logging as logging
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# create formatted logger
|
|
|
|
|
formatted_logger = logging.get_formatted_logger(
|
|
|
|
|
'example_decorator_logger',
|
|
|
|
|
console=True,
|
|
|
|
|
console_level=logging.DEBUG,
|
|
|
|
|
file=True,
|
|
|
|
|
file_path=r'log\decorator_logger.log',
|
|
|
|
|
file_level=logging.DEBUG,
|
|
|
|
|
file_backup_count=5,
|
|
|
|
|
file_rotate='h',
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# use logging decorator with custom logger
|
|
|
|
|
@logging.Decorator.debug(logger=formatted_logger, arg=True, kwarg=True, return_value=True, decimal_places=1)
|
|
|
|
|
def example_function(first_param, second_param, *args, **kwargs):
|
|
|
|
|
return first_param, second_param, *args, *kwargs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# execute function
|
|
|
|
|
example_function('Hello', 'world', 'test', 'example', hello='world', world='test')
|
|
|
|
|
|
|
|
|
|
```
|