fix date fro today

This commit is contained in:
Jonathan Baecker 2020-05-12 14:03:51 +02:00
parent f9e65e8dac
commit 8b9f19145f

View File

@ -1,6 +1,6 @@
import json import json
import os import os
from datetime import date from datetime import datetime
from platform import uname from platform import uname
from subprocess import PIPE, STDOUT, run from subprocess import PIPE, STDOUT, run
from time import sleep from time import sleep
@ -55,7 +55,7 @@ def read_log(type, _date):
config = read_yaml() config = read_yaml()
log_path = config['logging']['log_path'] log_path = config['logging']['log_path']
if _date == date.today(): if _date == datetime.now().strftime('%Y-%m-%d'):
log_file = os.path.join(log_path, '{}.log'.format(type)) log_file = os.path.join(log_path, '{}.log'.format(type))
else: else:
log_file = os.path.join(log_path, '{}.log.{}'.format(type, _date)) log_file = os.path.join(log_path, '{}.log.{}'.format(type, _date))