Package: logging-mv-integrations
logging-mv-integrationsExtension to Pythonloggingfunctionality
intended for TUNE Multiverse Integrations.BadgesdocsinfotestspackageotherInstallpipinstalllogging_mv_integrationsArchitecturelogging-mv-integrationsis an extension of thelogging facility for Pythonused for TUNE Multiverse Integrations providing custom logger levels, format, and output.Function: get_logger()defget_logger(logger_name,logger_version=None,logger_level=logging.INFO,logger_format=LoggingFormat.JSON,logger_output=LoggingOutput.STDOUT_COLOR,logger_handler=None):get_logger(): ParametersParameterPurposelogger_nameReturn a logger with the specified name or, if name is None, return a logger which is the root logger of the hierarchy.logger_versionlogger_formatLoggingFormatlogger_outputLoggingOutputlogger_handlerlogging.StreamHandler() or logging.FileHandler()Logging LevelsSame Python logging levels, including one additional level NOTE.LevelPurposeDEBUGDetailed information, typically of interest only when diagnosing problems.NOTEDetailed information, request processing, for example, request using cURL.INFOConfirmation that things are working as expected.[DEFAULT]WARNINGAn indication that something unexpected happened, or indicative of some problem in the near future. The software is still working as expected.ERRORDue to a more serious problem, the software has not been able to perform some function.CRITICALA serious error, indicating that the program itself may be unable to continue running.Logging FormatFormatPurposeSTANDARDStandard logging format.JSONJSON logging format.[DEFAULT]classLoggingFormat(object):"""TUNE Logging Format ENUM
    """STANDARD="standard"JSON="json"Logging OutputOutputPurposeSTDOUTStandard Output to terminalSTDOUT_COLORStandard Output using colored terminalFILEStandard Output to file created within./tmp/log_<epoch time seconds>.json.classLoggingOutput(object):"""TUNE Logging Output ENUM
    """STDOUT="stdout"STDOUT_COLOR="color"FILE="file"Logging JSON Formatimportloggingfromlogging_mv_integrationsimport(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__})Logging JSON Example Output$python3examples/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__"}Requirementslogging-mv-integrationsmodule is built upon Python 3 and has dependencies upon
several Python modules available withinPython Package Index PyPI.makeinstall-requirementsorpython3-mpipuninstall--yes--no-input-rrequirements.txtpython3-mpipinstall--upgrade-rrequirements.txtDependenciescoloredlogs:https://pypi.python.org/pypi/coloredlogspprintpp:https://pypi.python.org/pypi/pprintpppython-json-logger:https://pypi.python.org/pypi/python-json-loggerPygments:https://pypi.python.org/pypi/Pygmentssafe-cast:https://pypi.python.org/pypi/safe-castwheel:https://pypi.python.org/pypi/wheelRelease History0.5.4 (2018-02-16)migrate to github/TuneLab0.5.3 (2018-01-25)migrate to github/tuneinc0.5.2 (2017-12-10)readthedocs.org0.4.0 (2017-11-24)README0.3.2 (2017-11-21)READMETravis CI0.1.7 (2017-10-26)Using Formatted String Literals0.1.6 (2017-10-19)Logging Output: FILE, STDOUT, STDOUT_COLOR0.1.5 (2017-10-17)Fix standard format0.1.4 (2017-10-09)Multiple handlers fix0.1.3 (2017-09-12)Use python standard logging instead of tune_logging and remove all unneeded files0.1.2 (2017-02-03)Switch to using casting from safe-cast package0.1.1 (2017-02-03)Python 3.6 Upgrade0.0.1 (2016-11-19)First Commit