进阶第十四课 Python模块之logging

logging,就是登录模块。

提供了几个方法:critical、error、warning、info、debug和notset,且按照上述次序级别越来越低。

默认的格式为日志级别:Logger名:用户输出消息。

比如:在IDLE打开一个新窗口,输入下列代码,并保存为logging.py。

import logging
>>> import logging
>>> logging.debug('debug message')
>>> logging.info('info message')
>>> logging.warning('warning message')
>>> logging.error('error.message')
>>> loggin.critical('critical message')

在IDLE中调用这个loggin.py,会报错,但是只报了3行,也就是后三行。

 

posted @ 2018-04-01 17:22  驼背蜗牛  阅读(140)  评论(0编辑  收藏  举报