当前位置:网站首页>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")


边栏推荐
- 2022-07-23:给定N件物品,每个物品有重量(w[i])、有价值(v[i]), 只能最多选两件商品,重量不超过bag,返回价值最大能是多少? N <= 10^5, w[i] <= 10^5, v
- 我的创作纪念日
- [line test] Figure finding regular questions
- R语言手写数字识别
- Vulnhub DC1
- Induction, generalization, deduction
- MySQL queries all parents of the current node
- numpy.cumsum
- C language advanced part II Pointer
- [sklearn] RF cross validation out of bag data parameter learning curve grid search
猜你喜欢

Network security B module windows operating system penetration test of national vocational college skills competition

Simple installation of sqli Labs

C language advanced part III. string functions and memory operation functions

Oauth2==sso three protocols. Oauth2 four modes

系统集成项目管理工程师(软考中级)重点知识、背诵版

Jenkins 详细部署

【FreeRTOS】11 软件定时器

Mitre att & CK ultra detailed learning notes-02 (a large number of cases)

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

System integration project management engineer (soft test intermediate) key knowledge, recitation version
随机推荐
24.全局事件总线
Introduction to C language
There are two tables in Oracle, a and B. these two tables need to be associated with the third table C. how to update the field MJ1 in table a to the value MJ2 in table B
System integration project management engineer (soft test intermediate) key knowledge, recitation version
FlinkSQL-UDF自定义数据源
Bookkeeping app: xiaoha bookkeeping 1 - production of welcome page
[sklearn] data preprocessing
C language file operation
Induction, generalization, deduction
无法自动装配,未找到“RedisTemplate类型的Bean
拉普拉斯(Laplace)分布
UNI-APP_ Playback and pause of background music of applet or H5 page
PHP escape string
Introduction to C language v First understanding pointer VI. first understanding structure
XSS漏洞学习
Introduction to C language I. branch and loop statements
numpy.cumsum
Deep learning two or three things - review those classical convolutional neural networks
【Pytorch】conv2d torchvision.transforms
Laplace distribution