当前位置:网站首页>Basic use of logging
Basic use of logging
2022-07-26 10:56:00 【Yasso won't blow】
import logging
''' basicConfig() Method level The lowest level datefmt Time format format Text format in the log %()s Fixed format filename Save filename '''
#
# ''' By default, only info Log above level '''
#logging.basicConfig(level=logging.DEBUG)
# logging.debug("debug The level of log : Print all the logs , Details , It's usually only a diagnostic problem ")
#
# logging.info("info The level of log : Print info,warning,error,critical Level of logging , Make sure everything works as expected ")
#
# logging.warning("warning The level of log : Print warning,error,critical Level of logging , A trace "
# " Image indication , Something unexpected happened , Or show some problems in the near future ( for example . Low disk space ”), The software works as expected ")
#
# logging.error("error The level of log : Print error,critical Level of logging , More serious problem , The software doesn't perform some functions ")
#
# logging.critical("critical The level of log : Print critical Level , A serious mistake , This indicates that the program itself may not continue to run ")
# ''' Set log display variables '''
#
# name=" millet "
# age=18
# logging.basicConfig(level=logging.DEBUG)
#
# ''' This debug Use lowercase , An error will be reported in words '''
# logging.debug(" full name {}, Age {}".format(name,age))
# logging.debug(" full name %s, Age %d",name,age)
''' Set the log display content '''
logging.basicConfig(level=logging.DEBUG,format='%(asctime)s %(name)s %(levelname)s %(module)s: %(message)s'
,datefmt='%Y-%m-%d %H:%M:%S')
logging.debug(' Set text output content ')
logging.debug('asctime Time ')
logging.debug('name name ')
logging.debug("levelname Current log level ")
logging.debug("module Current location ")
logging.debug("message Text information ")
边栏推荐
猜你喜欢

LE Audio规范概述

Bash shell学习笔记(三)

很多人都不清楚自己找的是Kanban软件还是看板软件

ThreadPoolExecutor是怎样执行任务的

Bash shell learning notes (II)

mysql20210906

pytest conftest.py和fixture的配合使用

RT thread learning notes (V) -- edit, download and debug programs

2021-08-12 function recursion_ Learn C language with brother Peng

RT thread learning notes (I) -- configure RT thread development environment
随机推荐
MFC picture control
35. Search the insertion position
logging 学习最终版-配置的不同级别日志打印的颜色
Bash shell学习笔记(六)
@The real difference and usage between validated and @valid
27. Remove elements
BLE之ATT请求
Codepoint 58880 not found in font, aborting. flutter build apk时报错
用两个栈实现队列
Bash shell学习笔记(四)
WinPcap packet capturing function pcap_ Loop (), stop the problem
@The difference and use of jsonformat and @datetimeformat
二叉树的遍历 递归+迭代
很多人都不清楚自己找的是Kanban软件还是看板软件
Solve the problem of the popularity of org.apache.commons.codec.binary.base64
1748.唯一元素的和
@Notblank, @notnull, @notempty differences and uses
C#委托与匿名方法浅析
What are the biz layer and manager layer in the company project
Kali view IP address