mirror of
https://github.com/StuffAnThings/qbit_manage.git
synced 2025-03-09 22:35:07 +08:00
Update qbit_manage.py
This commit is contained in:
parent
2efa816372
commit
bc1987a41f
1 changed files with 6 additions and 1 deletions
|
@ -1,9 +1,11 @@
|
||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
|
||||||
from qbittorrentapi import Client
|
from qbittorrentapi import Client
|
||||||
import yaml
|
import yaml
|
||||||
import argparse
|
import argparse
|
||||||
import logging
|
import logging
|
||||||
|
from logging.handlers import RotatingFileHandler
|
||||||
import sys
|
import sys
|
||||||
# import apprise
|
# import apprise
|
||||||
|
|
||||||
|
@ -62,7 +64,10 @@ with open(args.config, "r") as cfg_file:
|
||||||
log_lev = getattr(logging, args.loglevel.upper())
|
log_lev = getattr(logging, args.loglevel.upper())
|
||||||
file_handler = logging.FileHandler(filename=args.logfile)
|
file_handler = logging.FileHandler(filename=args.logfile)
|
||||||
stdout_handler = logging.StreamHandler(sys.stdout)
|
stdout_handler = logging.StreamHandler(sys.stdout)
|
||||||
handlers = [file_handler, stdout_handler]
|
rotate_handler = RotatingFileHandler(filename=args.logfile,
|
||||||
|
maxBytes=1024 * 1024 * 2,
|
||||||
|
backupCount=5)
|
||||||
|
handlers = [file_handler, stdout_handler, rotate_handler]
|
||||||
|
|
||||||
# noinspection PyArgumentList
|
# noinspection PyArgumentList
|
||||||
logging.basicConfig(level=log_lev,
|
logging.basicConfig(level=log_lev,
|
||||||
|
|
Loading…
Reference in a new issue