diff --git a/app/__init__.py b/app/__init__.py index 0ef65d0..068b1f9 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -67,23 +67,21 @@ def create_app(config_class=None): app = Flask(__name__) app.config.from_object(config_class) + # Log to stdout or to file + # app.logger.removeHandler(default_handler) - - # Log to stdout if app.debug or app.testing or app.config['LOG_TO_STDOUT']: - stream_handler = logging.StreamHandler() - app.logger.addHandler(stream_handler) - # or log to file - # TODO: get filename from config + log_handler = logging.StreamHandler() else: logs_file = app.config['PDC_LOGS_FILE'] logs_dir = os.path.dirname(logs_file) if not os.path.exists(logs_dir): os.mkdir(logs_dir) - file_handler = RotatingFileHandler(logs_file, maxBytes=10240, backupCount=10) - file_handler.setFormatter(logging.Formatter( - '%(asctime)s %(levelname)s: %(message)s [in %(pathname)s:%(lineno)d]')) - app.logger.addHandler(file_handler) + log_handler = RotatingFileHandler(logs_file, maxBytes=10240, backupCount=10) + + log_handler.setFormatter(logging.Formatter( + '%(asctime)s %(levelname)s: %(message)s [in %(pathname)s:%(lineno)d]')) + app.logger.addHandler(log_handler) app.logger.setLevel(app.config['PDC_LOGS_LEVEL']) app.logger.info("Starting PDC-WEB") @@ -95,6 +93,7 @@ def create_app(config_class=None): # from .main import bp as main_bp app.register_blueprint(main_bp) + from .auth import bp as auth_bp app.register_blueprint(auth_bp) -- libgit2 0.21.2