Python logging package extensions for TUNE mv-integrations.
Project description
.. -*- mode: rst -*-
logging-mv-integrations
-----------------------
``logging-mv-integrations`` is a Python logging library for TUNE Multiverse Integrations.
Badges
------
.. start-badges
.. list-table::
:stub-columns: 1
* - docs
- |license|
* - tests
- |travis| |coveralls|
* - package
- |version| |supported-versions|
.. |docs| image:: https://readthedocs.org/projects/logging-mv-integrations/badge/?style=flat
:alt: Documentation Status
:target: https://readthedocs.org/projects/logging-mv-integrations
.. |license| image:: https://img.shields.io/badge/License-MIT-yellow.svg
:alt: License Status
:target: https://opensource.org/licenses/MIT
.. |travis| image:: https://travis-ci.org/TuneLab/logging-mv-integrations.svg?branch=master
:alt: Travis-CI Build Status
:target: https://travis-ci.org/TuneLab/logging-mv-integrations
.. |coveralls| image:: https://coveralls.io/repos/TuneLab/logging-mv-integrations/badge.svg?branch=master&service=github
:alt: Code Coverage Status
:target: https://coveralls.io/r/TuneLab/logging-mv-integrations
.. |requires| image:: https://requires.io/github/TuneLab/logging-mv-integrations/requirements.svg?branch=master
:alt: Requirements Status
:target: https://requires.io/github/TuneLab/logging-mv-integrations/requirements/?branch=master
.. |version| image:: https://img.shields.io/pypi/v/logging_mv_integrations.svg?style=flat
:alt: PyPI Package latest release
:target: https://pypi.python.org/pypi/logging_mv_integrations
.. |supported-versions| image:: https://img.shields.io/pypi/pyversions/tune_reporting.svg?style=flat
:alt: Supported versions
:target: https://pypi.python.org/pypi/tune_reporting
.. end-badges
Install
-------
.. code-block:: bash
pip install logging_mv_integrations
UML
---
``logging-mv-integrations`` is a Python logging library for TUNE Multiverse Integrations.
.. image:: ./images/logging_mv_integrations.png
:scale: 50 %
:alt: UML logging-mv-integrations
Function: get_logger()
----------------------
.. code-block:: python
def get_logger(
logger_name,
logger_version=None,
logger_level=logging.INFO,
logger_format=LoggingFormat.JSON,
logger_output=LoggingOutput.STDOUT_COLOR,
logger_handler=None
):
get_logger(): Parameters
------------------------
+-----------------+-------------------------------------------------------------------------------------------------------------------------+
| Parameter | Purpose |
+=================+=========================================================================================================================+
| logger_name | Return a logger with the specified name or, if name is None, return a logger which is the root logger of the hierarchy. |
+-----------------+-------------------------------------------------------------------------------------------------------------------------+
| logger_version | |
+-----------------+-------------------------------------------------------------------------------------------------------------------------+
| logger_format | LoggingFormat |
+-----------------+-------------------------------------------------------------------------------------------------------------------------+
| logger_output | LoggingOutput |
+-----------------+-------------------------------------------------------------------------------------------------------------------------+
| logger_handler | logging.StreamHandler() or logging.FileHandler() |
+-----------------+-------------------------------------------------------------------------------------------------------------------------+
Logging Levels
--------------
Same logging levels, however, including one additional level **NOTE**.
+------------+------------------------------------------------------------------------------------------------------------------------------------------------+
| Level | When it’s used |
+============+================================================================================================================================================+
| DEBUG | Detailed information, typically of interest only when diagnosing problems. |
+------------+------------------------------------------------------------------------------------------------------------------------------------------------+
| NOTE | Detailed information, request processing, for example, request using cURL. |
+------------+------------------------------------------------------------------------------------------------------------------------------------------------+
| INFO | Confirmation that things are working as expected. *[DEFAULT]* |
+------------+------------------------------------------------------------------------------------------------------------------------------------------------+
| WARNING | An indication that something unexpected happened, or indicative of some problem in the near future. The software is still working as expected. |
+------------+------------------------------------------------------------------------------------------------------------------------------------------------+
| ERROR | Due to a more serious problem, the software has not been able to perform some function. |
+------------+------------------------------------------------------------------------------------------------------------------------------------------------+
| CRITICAL | A serious error, indicating that the program itself may be unable to continue running. |
+------------+------------------------------------------------------------------------------------------------------------------------------------------------+
Logging Format
--------------
+------------+-------------------------------------------------------------------------------------------------------+
| Format | Purpose |
+============+=======================================================================================================+
| STANDARD | Standard logging format. |
+------------+-------------------------------------------------------------------------------------------------------+
| JSON | JSON logging format. *[DEFAULT]* |
+------------+-------------------------------------------------------------------------------------------------------+
.. code-block:: python
class LoggingFormat(object):
"""TUNE Logging Format ENUM
"""
STANDARD = "standard"
JSON = "json"
Logging Output
--------------
+--------------+----------------------------------------------------------------------------------------------+
| Output | Purpose |
+==============+==============================================================================================+
| STDOUT | Standard Output to terminal |
+--------------+----------------------------------------------------------------------------------------------+
| STDOUT_COLOR | Standard Output using colored terminal |
+--------------+----------------------------------------------------------------------------------------------+
| FILE | Standard Output to file created within *./tmp/log_<epoch time seconds>.json*. |
+--------------+----------------------------------------------------------------------------------------------+
.. code-block:: python
class LoggingOutput(object):
"""TUNE Logging Output ENUM
"""
STDOUT = "stdout"
STDOUT_COLOR = "color"
FILE = "file"
Logging JSON Format
-------------------
.. code-block:: python
import logging
from logging_mv_integrations import (LoggingFormat, get_logger, __version__)
log = get_logger(
logger_name=__name__,
logger_version=__version__,
logger_format=LoggingFormat.JSON,
logger_level=logging.NOTE
)
log.info("logging: info", extra={'test': __name__})
log.note("logging: note", extra={'test': __name__})
log.debug("logging: debug", extra={'test': __name__})
log.warning("logging: warning", extra={'test': __name__})
log.error("logging: error", extra={'test': __name__})
log.critical("logging: critical", extra={'test': __name__})
log.exception("logging: exception", extra={'test': __name__})
.. code-block:: bash
$ python3 examples/example_logging_json.py
{"asctime": "2017-10-20 08:31:14 -0700", "levelname": "INFO", "name": "__main__", "version": "0.1.6", "message": "logging: info", "test": "__main__"}
{"asctime": "2017-10-20 08:31:14 -0700", "levelname": "NOTE", "name": "__main__", "version": "0.1.6", "message": "logging: note", "test": "__main__"}
{"asctime": "2017-10-20 08:31:14 -0700", "levelname": "WARNING", "name": "__main__", "version": "0.1.6", "message": "logging: warning", "test": "__main__"}
{"asctime": "2017-10-20 08:31:14 -0700", "levelname": "ERROR", "name": "__main__", "version": "0.1.6", "message": "logging: error", "test": "__main__"}
{"asctime": "2017-10-20 08:31:14 -0700", "levelname": "CRITICAL", "name": "__main__", "version": "0.1.6", "message": "logging: critical", "test": "__main__"}
{"asctime": "2017-10-20 08:31:14 -0700", "levelname": "ERROR", "name": "__main__", "version": "0.1.6", "message": "logging: exception", "exc_info": "NoneType: None", "test": "__main__"}
Dependencies
------------
``logging-mv-integrations`` module is built upon Python 3 and is build upon
several custom modules that are held within PyPI: https://pypi.python.org/pypi
.. code-block:: bash
make install-requirements
or
.. code-block:: bash
python3 -m pip uninstall --yes --no-input -r requirements.txt
python3 -m pip install --upgrade -r requirements.txt
Support Packages
----------------
These packages provide support functionality but are not core
to Multiverse. Thereby, test and documentation could be shared
amongst the team.
- safe-cast: https://pypi.python.org/pypi/safe-cast
Support Packages
----------------
- coloredlogs: https://pypi.python.org/pypi/coloredlogs
- pprintpp: https://pypi.python.org/pypi/pprintpp
- python-json-logger: https://pypi.python.org/pypi/python-json-logger
- Pygments: https://pypi.python.org/pypi/Pygments
- wheel: https://pypi.python.org/pypi/wheel
.. :changelog:
Release History
===============
0.1.8 (2017-11-21)
------------------
- README
0.1.7 (2017-10-26)
------------------
- Using Formatted String Literals
0.1.6 (2017-10-19)
------------------
- Logging Output: FILE, STDOUT, STDOUT_COLOR
0.1.5 (2017-10-17)
------------------
- Fix standard format
0.1.4 (2017-10-09)
------------------
- Multiple handlers fix
0.1.3 (2017-09-12)
------------------
- Use python standard logging instead of tune_logging and remove all unneeded files
0.1.2 (2017-02-03)
------------------
- Switch to using casting from safe-cast package
0.1.1 (2017-02-03)
------------------
- Python 3.6 Upgrade
0.0.1 (2016-11-19)
------------------
- First Commit
logging-mv-integrations
-----------------------
``logging-mv-integrations`` is a Python logging library for TUNE Multiverse Integrations.
Badges
------
.. start-badges
.. list-table::
:stub-columns: 1
* - docs
- |license|
* - tests
- |travis| |coveralls|
* - package
- |version| |supported-versions|
.. |docs| image:: https://readthedocs.org/projects/logging-mv-integrations/badge/?style=flat
:alt: Documentation Status
:target: https://readthedocs.org/projects/logging-mv-integrations
.. |license| image:: https://img.shields.io/badge/License-MIT-yellow.svg
:alt: License Status
:target: https://opensource.org/licenses/MIT
.. |travis| image:: https://travis-ci.org/TuneLab/logging-mv-integrations.svg?branch=master
:alt: Travis-CI Build Status
:target: https://travis-ci.org/TuneLab/logging-mv-integrations
.. |coveralls| image:: https://coveralls.io/repos/TuneLab/logging-mv-integrations/badge.svg?branch=master&service=github
:alt: Code Coverage Status
:target: https://coveralls.io/r/TuneLab/logging-mv-integrations
.. |requires| image:: https://requires.io/github/TuneLab/logging-mv-integrations/requirements.svg?branch=master
:alt: Requirements Status
:target: https://requires.io/github/TuneLab/logging-mv-integrations/requirements/?branch=master
.. |version| image:: https://img.shields.io/pypi/v/logging_mv_integrations.svg?style=flat
:alt: PyPI Package latest release
:target: https://pypi.python.org/pypi/logging_mv_integrations
.. |supported-versions| image:: https://img.shields.io/pypi/pyversions/tune_reporting.svg?style=flat
:alt: Supported versions
:target: https://pypi.python.org/pypi/tune_reporting
.. end-badges
Install
-------
.. code-block:: bash
pip install logging_mv_integrations
UML
---
``logging-mv-integrations`` is a Python logging library for TUNE Multiverse Integrations.
.. image:: ./images/logging_mv_integrations.png
:scale: 50 %
:alt: UML logging-mv-integrations
Function: get_logger()
----------------------
.. code-block:: python
def get_logger(
logger_name,
logger_version=None,
logger_level=logging.INFO,
logger_format=LoggingFormat.JSON,
logger_output=LoggingOutput.STDOUT_COLOR,
logger_handler=None
):
get_logger(): Parameters
------------------------
+-----------------+-------------------------------------------------------------------------------------------------------------------------+
| Parameter | Purpose |
+=================+=========================================================================================================================+
| logger_name | Return a logger with the specified name or, if name is None, return a logger which is the root logger of the hierarchy. |
+-----------------+-------------------------------------------------------------------------------------------------------------------------+
| logger_version | |
+-----------------+-------------------------------------------------------------------------------------------------------------------------+
| logger_format | LoggingFormat |
+-----------------+-------------------------------------------------------------------------------------------------------------------------+
| logger_output | LoggingOutput |
+-----------------+-------------------------------------------------------------------------------------------------------------------------+
| logger_handler | logging.StreamHandler() or logging.FileHandler() |
+-----------------+-------------------------------------------------------------------------------------------------------------------------+
Logging Levels
--------------
Same logging levels, however, including one additional level **NOTE**.
+------------+------------------------------------------------------------------------------------------------------------------------------------------------+
| Level | When it’s used |
+============+================================================================================================================================================+
| DEBUG | Detailed information, typically of interest only when diagnosing problems. |
+------------+------------------------------------------------------------------------------------------------------------------------------------------------+
| NOTE | Detailed information, request processing, for example, request using cURL. |
+------------+------------------------------------------------------------------------------------------------------------------------------------------------+
| INFO | Confirmation that things are working as expected. *[DEFAULT]* |
+------------+------------------------------------------------------------------------------------------------------------------------------------------------+
| WARNING | An indication that something unexpected happened, or indicative of some problem in the near future. The software is still working as expected. |
+------------+------------------------------------------------------------------------------------------------------------------------------------------------+
| ERROR | Due to a more serious problem, the software has not been able to perform some function. |
+------------+------------------------------------------------------------------------------------------------------------------------------------------------+
| CRITICAL | A serious error, indicating that the program itself may be unable to continue running. |
+------------+------------------------------------------------------------------------------------------------------------------------------------------------+
Logging Format
--------------
+------------+-------------------------------------------------------------------------------------------------------+
| Format | Purpose |
+============+=======================================================================================================+
| STANDARD | Standard logging format. |
+------------+-------------------------------------------------------------------------------------------------------+
| JSON | JSON logging format. *[DEFAULT]* |
+------------+-------------------------------------------------------------------------------------------------------+
.. code-block:: python
class LoggingFormat(object):
"""TUNE Logging Format ENUM
"""
STANDARD = "standard"
JSON = "json"
Logging Output
--------------
+--------------+----------------------------------------------------------------------------------------------+
| Output | Purpose |
+==============+==============================================================================================+
| STDOUT | Standard Output to terminal |
+--------------+----------------------------------------------------------------------------------------------+
| STDOUT_COLOR | Standard Output using colored terminal |
+--------------+----------------------------------------------------------------------------------------------+
| FILE | Standard Output to file created within *./tmp/log_<epoch time seconds>.json*. |
+--------------+----------------------------------------------------------------------------------------------+
.. code-block:: python
class LoggingOutput(object):
"""TUNE Logging Output ENUM
"""
STDOUT = "stdout"
STDOUT_COLOR = "color"
FILE = "file"
Logging JSON Format
-------------------
.. code-block:: python
import logging
from logging_mv_integrations import (LoggingFormat, get_logger, __version__)
log = get_logger(
logger_name=__name__,
logger_version=__version__,
logger_format=LoggingFormat.JSON,
logger_level=logging.NOTE
)
log.info("logging: info", extra={'test': __name__})
log.note("logging: note", extra={'test': __name__})
log.debug("logging: debug", extra={'test': __name__})
log.warning("logging: warning", extra={'test': __name__})
log.error("logging: error", extra={'test': __name__})
log.critical("logging: critical", extra={'test': __name__})
log.exception("logging: exception", extra={'test': __name__})
.. code-block:: bash
$ python3 examples/example_logging_json.py
{"asctime": "2017-10-20 08:31:14 -0700", "levelname": "INFO", "name": "__main__", "version": "0.1.6", "message": "logging: info", "test": "__main__"}
{"asctime": "2017-10-20 08:31:14 -0700", "levelname": "NOTE", "name": "__main__", "version": "0.1.6", "message": "logging: note", "test": "__main__"}
{"asctime": "2017-10-20 08:31:14 -0700", "levelname": "WARNING", "name": "__main__", "version": "0.1.6", "message": "logging: warning", "test": "__main__"}
{"asctime": "2017-10-20 08:31:14 -0700", "levelname": "ERROR", "name": "__main__", "version": "0.1.6", "message": "logging: error", "test": "__main__"}
{"asctime": "2017-10-20 08:31:14 -0700", "levelname": "CRITICAL", "name": "__main__", "version": "0.1.6", "message": "logging: critical", "test": "__main__"}
{"asctime": "2017-10-20 08:31:14 -0700", "levelname": "ERROR", "name": "__main__", "version": "0.1.6", "message": "logging: exception", "exc_info": "NoneType: None", "test": "__main__"}
Dependencies
------------
``logging-mv-integrations`` module is built upon Python 3 and is build upon
several custom modules that are held within PyPI: https://pypi.python.org/pypi
.. code-block:: bash
make install-requirements
or
.. code-block:: bash
python3 -m pip uninstall --yes --no-input -r requirements.txt
python3 -m pip install --upgrade -r requirements.txt
Support Packages
----------------
These packages provide support functionality but are not core
to Multiverse. Thereby, test and documentation could be shared
amongst the team.
- safe-cast: https://pypi.python.org/pypi/safe-cast
Support Packages
----------------
- coloredlogs: https://pypi.python.org/pypi/coloredlogs
- pprintpp: https://pypi.python.org/pypi/pprintpp
- python-json-logger: https://pypi.python.org/pypi/python-json-logger
- Pygments: https://pypi.python.org/pypi/Pygments
- wheel: https://pypi.python.org/pypi/wheel
.. :changelog:
Release History
===============
0.1.8 (2017-11-21)
------------------
- README
0.1.7 (2017-10-26)
------------------
- Using Formatted String Literals
0.1.6 (2017-10-19)
------------------
- Logging Output: FILE, STDOUT, STDOUT_COLOR
0.1.5 (2017-10-17)
------------------
- Fix standard format
0.1.4 (2017-10-09)
------------------
- Multiple handlers fix
0.1.3 (2017-09-12)
------------------
- Use python standard logging instead of tune_logging and remove all unneeded files
0.1.2 (2017-02-03)
------------------
- Switch to using casting from safe-cast package
0.1.1 (2017-02-03)
------------------
- Python 3.6 Upgrade
0.0.1 (2016-11-19)
------------------
- First Commit
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Close
Hashes for logging-mv-integrations-0.1.9.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f889a05b0fe2c59f9b3c4860976cecb8eed24f89457d8135079ae1574d762cc |
|
MD5 | ca2ad98335eb3db21ea8d067dc3cf907 |
|
BLAKE2b-256 | 9444c704ad367030a8760d5b26369f4bb38a75580f4b6b3105526ac08acfc18f |
Close
Hashes for logging_mv_integrations-0.1.9-py3.6.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 290709c010b1db1d5a8493830f8b2bf5d87c9a5caca3c1024b1fed4c1445b0da |
|
MD5 | 92c6eb7b8d584840aede79f94a808e82 |
|
BLAKE2b-256 | 19e8796787b2bf612b54dea06f3792c5412a4169f7884870b486a063ba8f642d |
Close
Hashes for logging_mv_integrations-0.1.9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a9dff657678c779d0055f361be3b61b04e557ba928acca978e789aa45c69e3c |
|
MD5 | 8efbdcbfdf5e955945b9a9aa58908bf1 |
|
BLAKE2b-256 | 6088d5b0b1c278903088687151c51ba617708dcbb17d363a403f71e710615566 |