当前位置:网站首页>Four components of logger
Four components of logger
2022-07-05 21:30:00 【Nuoyiyou ~】
1. Loggers
2. processor
3. Formatter
4. Filter
class Test_log:
def get_logger(self):
# The log level :debug info warning error critical
# The log level first depends on the logger , Then look at the log processor
# Create a logger
self.logger = logging.getLogger("logger")
self.logger.setLevel("DEBUG")
if not self.logger.handlers:
# Create processor
sh = logging.StreamHandler()
fh = logging.FileHandler("{}_log.txt".format(time.strftime("%Y_%m_%d_%H_%M_%S",time.localtime())))
# Create a formatter
fmt = logging.Formatter(fmt="%(asctime)s %(filename)s %(levelname)s %(message)s",datefmt="%Y/%m/%d_%H:%M:%S")
sh.setFormatter(fmt)
fh.setFormatter(fmt)
self.logger.addHandler(sh)
self.logger.addHandler(fh)
return self.logger边栏推荐
- Influence of oscilloscope probe on signal source impedance
- selenium 查找b或p标签的内容
- @Validated基础参数校验、分组参数验证和嵌套参数验证
- selenium 获取dom内属性值的方法
- R language learning notes
- Deployment of Jenkins under win7
- Which securities company is better and which platform is safer for stock account opening
- Generics of TS
- Making global exception handling classes with aspect
- Zhang Lijun: la pénétration de l’incertitude dépend de quatre « invariants»
猜你喜欢

Incentive mechanism of Ethereum eth

力扣------经营摩天轮的最大利润

1.2 download and installation of the help software rstudio

XML modeling

Access Zadig self-test environment outside the cluster based on ingress controller (best practice)

Evolution of zhenai microservice underlying framework from open source component encapsulation to self-development

xlrd常见操作
![[case] Application of element display and hiding -- element mask](/img/6e/6ea484a6e5d547e01dd8820af8e314.png)
[case] Application of element display and hiding -- element mask

Teach yourself to train pytorch model to Caffe (III)
![Longest swing sequence [greedy practice]](/img/e1/70dc21b924232c7e5e3da023a4bed2.png)
Longest swing sequence [greedy practice]
随机推荐
Comparison table of foreign lead American abbreviations
Get JS of the previous day (timestamp conversion)
@Validated basic parameter verification, grouping parameter verification and nested parameter verification
Learning robots have no way to start? Let me show you the current hot research directions of robots
postgis 安装地理信息扩展
[case] Application of element display and hiding -- element mask
Parker driver maintenance COMPAX controller maintenance cpx0200h
SQL knowledge leak detection
postgres 建立连接并删除记录
How to send samples when applying for BS 476-7 display? Is it the same as the display??
Reading and writing operations of easyexcel
100 cases of shell programming
PVC plastic sheets BS 476-6 determination of flame propagation properties
2022-07-03-CKA-粉丝反馈最新情况
selenium 查找b或p标签的内容
Introduction of ArcGIS grid resampling method
Test of incombustibility of cement adhesives BS 476-4
基于vertx-web-sstore-redis的改造实现vertx http应用的分布式session
Determine the best implementation of horizontal and vertical screens
[daily training] 729 My schedule I