aboutsummaryrefslogtreecommitdiffstats
path: root/python/calibrate_tranches_BC.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/calibrate_tranches_BC.py')
-rw-r--r--python/calibrate_tranches_BC.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/python/calibrate_tranches_BC.py b/python/calibrate_tranches_BC.py
index 4961f74f..cf04ea24 100644
--- a/python/calibrate_tranches_BC.py
+++ b/python/calibrate_tranches_BC.py
@@ -33,7 +33,6 @@ def build_sql_str(df):
if __name__ == "__main__":
- logging.basicConfig()
logger = logging.getLogger('tranche_calib')
parser = argparse.ArgumentParser()
parser.add_argument("-u", "--update", action="store_true", default=False,
@@ -51,12 +50,14 @@ if __name__ == "__main__":
logger.setLevel(logging.DEBUG if args.debug else logging.INFO)
CODE_DIR = Path(os.environ["CODE_DIR"])
LOG_DIR = Path(os.environ["LOG_DIR"])
+ formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
if not args.debug:
- fh = logging.FileHandler(filename=LOG_DIR /
- f"calib_tranches_{datetime.date.today()}.log")
- formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
- fh.setFormatter(formatter)
- logger.addHandler(fh)
+ handler = logging.FileHandler(filename=LOG_DIR /
+ f"calib_tranches_{datetime.date.today()}.log")
+ else:
+ handler = logging.StreamHandler()
+ handler.setFormatter(formatter)
+ logger.addHandler(handler)
start_dates = {# 'hy10': datetime.date(2014, 8, 11),
# 'hy15': datetime.date(2014, 6, 10),