From f44285038cafe34611c9fa95ad47dd54f9d91119 Mon Sep 17 00:00:00 2001 From: Ben Letham Date: Mon, 3 Dec 2018 16:29:07 -0800 Subject: [PATCH] Allow setting other handlers in the logging --- python/fbprophet/diagnostics.py | 2 +- python/fbprophet/forecaster.py | 6 ++++-- python/fbprophet/plot.py | 3 +-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/python/fbprophet/diagnostics.py b/python/fbprophet/diagnostics.py index 7de2b26..f6ef209 100644 --- a/python/fbprophet/diagnostics.py +++ b/python/fbprophet/diagnostics.py @@ -17,7 +17,7 @@ import logging import numpy as np import pandas as pd -logger = logging.getLogger(__name__) +logger = logging.getLogger('fbprophet') def generate_cutoffs(df, horizon, initial, period): diff --git a/python/fbprophet/forecaster.py b/python/fbprophet/forecaster.py index e05f5fb..163e4e5 100644 --- a/python/fbprophet/forecaster.py +++ b/python/fbprophet/forecaster.py @@ -31,8 +31,10 @@ from fbprophet.plot import ( plot_seasonality, ) -logging.basicConfig() -logger = logging.getLogger(__name__) +logger = logging.getLogger('fbprophet') +logger.addHandler(logging.NullHandler()) +if len(logger.handlers) == 1: + logging.basicConfig(level=logging.INFO) class Prophet(object): diff --git a/python/fbprophet/plot.py b/python/fbprophet/plot.py index 246c03d..1dced4f 100644 --- a/python/fbprophet/plot.py +++ b/python/fbprophet/plot.py @@ -17,9 +17,8 @@ import pandas as pd from fbprophet.diagnostics import performance_metrics +logger = logging.getLogger('fbprophet') -logging.basicConfig() -logger = logging.getLogger(__name__) try: from matplotlib import pyplot as plt