minor update to fix a file logging issue, where it will skip log numbers IE zeus-log-1.log to zeus-log-5.log

This commit is contained in:
ekultek 2017-11-21 12:39:15 -06:00
parent d875092c6c
commit 47b4789756

View file

@ -56,7 +56,7 @@ CLONE = "https://github.com/ekultek/zeus-scanner.git"
ISSUE_LINK = "https://github.com/ekultek/zeus-scanner/issues"
# current version <major.minor.commit.patch ID>
VERSION = "1.2.27.{}".format(PATCH_ID)
VERSION = "1.2.28".format(PATCH_ID)
# colors to output depending on the version
VERSION_TYPE_COLORS = {"dev": 33, "stable": 92, "other": 30}
@ -314,13 +314,13 @@ DBMS_ERRORS = {
# this has to be the first function so that I can use it in the logger settings below
def create_log_name(log_path="{}/log", filename="zeus-log-{}.log"):
def create_log_name(log_path="{}/log", filename="zeus-log-{}.log", matcher="zeus-log"):
"""
create the current log file name by figuring out how many files are there
"""
if not os.path.exists(log_path.format(os.getcwd())):
os.mkdir(log_path.format(os.getcwd()))
find_file_amount = len(os.listdir(log_path.format(os.getcwd())))
find_file_amount = len([f for f in os.listdir(log_path.format(os.getcwd())) if matcher in f])
full_log_path = "{}/{}".format(log_path.format(os.getcwd()), filename.format(find_file_amount + 1))
return full_log_path