当前位置:网站首页>Selenium basic knowledge debugging method
Selenium basic knowledge debugging method
2022-07-24 07:36:00 【everyone_ yi】
# -*- coding: utf-8 -*-
''' p48 Log tool class logger.py Use logging Module custom encapsulates a log class @author freePHP @version 1.0.0 '''
import logging
import os.path
import time
from logging import handlers
class Logger(object):
def __init__(self):
self.logger = logging.getLogger("")
# Set the level of output
LEVELS = {
'NOSET': logging.NOTSET,
'DEBUG': logging.DEBUG,
'INFO': logging.INFO,
'WARNING': logging.WARNING,
'ERROR': logging.ERROR,
'CRITICAL': logging.CRITICAL}
# Create file directory
logs_dir="logs2"
if os.path.exists(logs_dir) and os.path.isdir(logs_dir):
pass
else:
os.mkdir(logs_dir)
# modify log Save the location
timestamp=time.strftime("%Y-%m-%d",time.localtime())
logfilename='%s.txt' % timestamp
logfilepath=os.path.join(logs_dir,logfilename)
rotatingFileHandler = logging.handlers.RotatingFileHandler(filename =logfilepath,
maxBytes = 1024 * 1024 * 50,
backupCount = 5)
# Set the output format
formatter = logging.Formatter('[%(asctime)s] [%(levelname)s] %(message)s', '%Y-%m-%d %H:%M:%S')
rotatingFileHandler.setFormatter(formatter)
# Console handle
console = logging.StreamHandler()
console.setLevel(logging.NOTSET)
console.setFormatter(formatter)
# Add content to the log handle
self.logger.addHandler(rotatingFileHandler)
self.logger.addHandler(console)
self.logger.setLevel(logging.NOTSET)
def info(self, message):
self.logger.info(message)
def debug(self, message):
self.logger.debug(message)
def warning(self, message):
self.logger.warning(message)
def error(self, message):
self.logger.error(message)
application
# -*- coding: utf-8 -*-
# call logger class use_logger.py
import logging
import logger
mylogger = logger.Logger()
mylogger.debug("Start to debug it")
mylogger.info ("Start to info it")
mylogger.warning("Start to warning")
mylogger.error("Something is wrong")


边栏推荐
- Customization or GM, what is the future development trend of SaaS in China?
- oracle中有A,B连个表,这两个表需要第三个表C关联,那怎么将A表中的字段MJ1更新为B表中MJ2的值
- numpy.cumsum
- Sense dimension design responsive layout
- XSS vulnerability learning
- Single Gmv has increased 100 times. What is the "general rule" behind the rise of popular brands?
- Vulnhub DC1
- A great hymn
- 二维平面多段线Y轴最短距离
- 【HiFlow】腾讯云HiFlow场景连接器实现校园信息管理智能化
猜你喜欢
![[sklearn] RF cross validation out of bag data parameter learning curve grid search](/img/1f/936e4fe42ed97de2c3caa3f025744d.png)
[sklearn] RF cross validation out of bag data parameter learning curve grid search

爬虫学习-概述

Unable to auto assemble, bean of type "redistemplate" not found

JS_实现多行文本根据换行分隔成数组

C language advanced part II Pointer

Compilation and debugging (GCC, g++, GDB)

Vulnhub DC1

二维平面多段线Y轴最短距离

PHP link log scheme

DOM operation of JS -- style operation
随机推荐
从CIA看常见网络攻击(爆破,PE,流量攻击)
Network security B module windows operating system penetration test of national vocational college skills competition
给一个字符串 ① 请统计出其中每一个字母出现的次数② 请打印出字母次数最多的那一对
Requests crawler implements a simple web page collector
Vulnhub DC1
Jenkins detailed deployment
[cloud native] MySQL index analysis and query optimization
B. Also Try Minecraft
23. Component customization events
Development system selection route
[word] how to generate the index directory on the left
游戏三子棋
MySQL语句
Jackson 解析 JSON 详细教程
fopen、fwrite、fseek、ftell、fread使用demo
MITRE ATT&CK超详细学习笔记-01(背景,术语,案例)
oracle中有A,B连个表,这两个表需要第三个表C关联,那怎么将A表中的字段MJ1更新为B表中MJ2的值
MySQL queries all parents of the current node
【Pytorch】nn.Module
【Pytorch】conv2d torchvision.transforms