Python中log的使用

  • Logging

    Logging is a means of tracking events that happen when some software runs.

    Events also have an importance which the developer ascribes to the events, the importance can also be called the levels or severity.

    The standard levels and their applicability are described below(in increasing order of severity):

    LevelWhen it’s usedNumeric Value
    NOTSET0
    DEBUGDetailed information,typically of interest only when diagnosing problems10
    INFOConfirmation that things are working as expeted20
    WARNING(default level)An indication that something unexpencted happened, or indicative of some problem in the near future(e.g. ‘disk space low’), The software is still working as expected.30
    ERRORDue to a more serious problem, the software has not been able to perform some function.40
    CRITICALA serious error,indicating that the program itself may be unable to continue running.50

    Events that are tracked can be handled in different ways,like printing them to the console or writing them to a disk file.

  • logging:Logging facility for Python

    logging is the Python standard library implementing Logging.

    The basic classes defined by the module,together with their functions,are listed below:

    • Loggers expose the interface that application code directly uses.
    • Handlers send the log records(created by loggers) to the appropriate destination.
    • Filters provide a finer grained facility for determining which log records to output.
    • Formatters specify the layout of log records in the final output.
  • Reference

  1. logging — Logging facility for Python
  2. Logging HOWTO
  3. Logging Cookbook
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值