python“logging”功能的扩展,用于优化多宇宙集成。

logging-mv-integrations的Python项目详细描述


记录MV集成

pythonlogging功能的扩展 旨在调整多元宇宙整合。

徽章

docsDocumentation StatusLicense Status
infoHit CountContributors
testsTravis-CI Build StatusCode Coverage Status
packagePyPI Package latest releaseSupported versions
otherRequirements Status

安装

pip install logging_mv_integrations

架构

logging-mv-integrationslogging facility for Python的扩展 用于优化提供自定义日志级别、格式和输出的多维集成。

UML logging-mv-integrations

函数: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():参数

ParameterPurpose
logger_nameReturn 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_formatLoggingFormat
logger_outputLoggingOutput
logger_handlerlogging.StreamHandler() or logging.FileHandler()

测井水平

相同的python日志记录级别,包括一个额外的级别说明。

LevelPurpose
DEBUGDetailed 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.

日志格式

FormatPurpose
STANDARDStandard logging format.
JSONJSON logging format. [DEFAULT]
classLoggingFormat(object):"""TUNE Logging Format ENUM
    """STANDARD="standard"JSON="json"

记录输出

OutputPurpose
STDOUTStandard Output to terminal
STDOUT_COLORStandard Output using colored terminal
FILEStandard Output to file created within ./tmp/log_<epoch time seconds>.json.
classLoggingOutput(object):"""TUNE Logging Output ENUM
    """STDOUT="stdout"STDOUT_COLOR="color"FILE="file"

记录json格式

importloggingfromlogging_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__})

记录json示例输出

$ 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__"}

要求

logging-mv-integrations模块基于python 3构建,并且依赖于 Python Package Index PyPI中提供了几个python模块。

make install-requirements

python3 -m pip uninstall --yes --no-input -r requirements.txt
python3 -m pip install --upgrade -r requirements.txt

0.5.4(2018-02-16)

  • 迁移到github/tunelab

0.5.3(2018-01-25)

  • 迁移到github/tuneinc

0.5.2(2017-12-10)

  • 阅读docs.org

0.4.0(2017-11-24)

  • 自述

0.3.2(2017-11-21)

  • 自述
  • 特拉维斯ci

0.1.7(2017-10-26)

  • 使用格式化字符串文本

0.1.6(2017-10-19)

  • 日志输出:文件、标准输出、标准输出颜色

0.1.5(2017-10-17)

  • 固定标准格式

0.1.4(2017-10-09)

  • 多个处理程序修复

0.1.3(2017-09-12)

  • 使用python标准日志记录,而不是调整日志记录,并删除所有不需要的文件

0.1.2(2017-02-03)

  • 切换到使用安全铸造包中的铸件

0.1.1(2017-02-03)

  • python 3.6升级

0.0.1(2016-11-19)

  • First Commit

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java如何从下拉列表中获取所选号码?   Java代码不允许我将一个方法从一个类调用到另一个类   java如何在集合的Assertj集合中进行验证   java最少重复/在数组中出现一次的项   java如何将复选框值传递给动作\u发送   java排序2D数组或排序1D+线性搜索。   java有没有比使用CountDownLatch更好的等待两个线程完成任务的方法?   java如何从liferay portlet读取Excel文件?   NumberFormatException,因为在准备好的Java语句上无法识别NULL   如何在JavaJDBC中运行SQL(MYSQL)存储过程?   使用开放街道地图的java路由   java我正在尝试添加两个多项式,它们的系数不同,度数也不同   java二叉树的垂直顺序遍历   java多数组输入   最终量化方法的java方法拦截器   eclipse中的java Tomcat 404错误   java异常在提交后从EntityManager获取会话时发生,在会话前关闭   java可以在另一个属性文件中生成一个属性文件吗   java通过文件输入计算最小/最大值   混合Java配置和XML Spring 4