From d7521876d7cb221860b0975b2a25eedca00206b7 Mon Sep 17 00:00:00 2001 From: andreas128 Date: Mon, 21 Aug 2017 20:23:17 +0200 Subject: Add logging directory creation for all log files --- dpd/main.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'dpd/main.py') diff --git a/dpd/main.py b/dpd/main.py index ae18182..72026dc 100755 --- a/dpd/main.py +++ b/dpd/main.py @@ -10,10 +10,16 @@ This engine calculates and updates the parameter of the digital predistortion module of ODR-DabMod.""" +import datetime +import os + import logging +dt = datetime.datetime.now().isoformat() +logging_path = "/tmp/dpd_{}".format(dt).replace(".","_").replace(":","-") +os.makedirs(logging_path) logging.basicConfig(format='%(asctime)s - %(module)s - %(levelname)s - %(message)s', datefmt='%Y-%m-%d %H:%M:%S', - filename='/tmp/dpd.log', + filename='{}/dpd.log'.format(logging_path), filemode='w', level=logging.DEBUG) -- cgit v1.2.3