fix logpath for real
This commit is contained in:
+4
-5
@@ -57,17 +57,16 @@ def getconf(fname):
|
||||
exit(1)
|
||||
|
||||
|
||||
def setupLogger(lvl="DEBUG"):
|
||||
def setupLogger(logpath, lvl="DEBUG"):
|
||||
"""
|
||||
Create a rotating log in a log folder
|
||||
"""
|
||||
|
||||
global log # Needed to log exceptions in src\util
|
||||
log = logging.getLogger()
|
||||
logpath = os.path.dirname(os.path.abspath(__file__)) + r"\log\myTS3.log"
|
||||
if not os.path.exists(os.path.dirname(logpath)):
|
||||
os.makedirs(os.path.dirname(logpath))
|
||||
handler = RotatingFileHandler(logpath, encoding='utf-8', maxBytes=5*1024*1024, backupCount=10)
|
||||
if not os.path.exists(logpath):
|
||||
os.makedirs(logpath)
|
||||
handler = RotatingFileHandler(logpath + r"\myTS3.log", encoding='utf-8', maxBytes=5*1024*1024, backupCount=10)
|
||||
logformat = logging.Formatter("%(asctime)s %(levelname)7s %(message)s", "%Y-%m-%d %H:%M:%S")
|
||||
handler.setFormatter(logformat)
|
||||
log.addHandler(handler)
|
||||
|
||||
Reference in New Issue
Block a user