|
|
@ -56,7 +56,7 @@ def create_app(config_class=Config): |
|
|
|
mail_handler = SMTPHandler( |
|
|
|
mail_handler = SMTPHandler( |
|
|
|
mailhost=(app.config['MAIL_SERVER'], app.config['MAIL_PORT']), |
|
|
|
mailhost=(app.config['MAIL_SERVER'], app.config['MAIL_PORT']), |
|
|
|
fromaddr='no-reply@' + app.config['MAIL_SERVER'], |
|
|
|
fromaddr='no-reply@' + app.config['MAIL_SERVER'], |
|
|
|
toaddrs=app.config['ADMINS'], subject='Microblog Failure', |
|
|
|
toaddrs=app.config['ADMINS'], subject='The-Hunt Failure', |
|
|
|
credentials=auth, secure=secure) |
|
|
|
credentials=auth, secure=secure) |
|
|
|
mail_handler.setLevel(logging.ERROR) |
|
|
|
mail_handler.setLevel(logging.ERROR) |
|
|
|
app.logger.addHandler(mail_handler) |
|
|
|
app.logger.addHandler(mail_handler) |
|
|
@ -68,7 +68,7 @@ def create_app(config_class=Config): |
|
|
|
else: |
|
|
|
else: |
|
|
|
if not os.path.exists('logs'): |
|
|
|
if not os.path.exists('logs'): |
|
|
|
os.mkdir('logs') |
|
|
|
os.mkdir('logs') |
|
|
|
file_handler = RotatingFileHandler('logs/microblog.log', |
|
|
|
file_handler = RotatingFileHandler('logs/the-hunt.log', |
|
|
|
maxBytes=10240, backupCount=10) |
|
|
|
maxBytes=10240, backupCount=10) |
|
|
|
file_handler.setFormatter(logging.Formatter( |
|
|
|
file_handler.setFormatter(logging.Formatter( |
|
|
|
'%(asctime)s %(levelname)s: %(message)s ' |
|
|
|
'%(asctime)s %(levelname)s: %(message)s ' |
|
|
@ -77,7 +77,7 @@ def create_app(config_class=Config): |
|
|
|
app.logger.addHandler(file_handler) |
|
|
|
app.logger.addHandler(file_handler) |
|
|
|
|
|
|
|
|
|
|
|
app.logger.setLevel(logging.INFO) |
|
|
|
app.logger.setLevel(logging.INFO) |
|
|
|
app.logger.info('Microblog startup') |
|
|
|
app.logger.info('The-Hunt startup') |
|
|
|
|
|
|
|
|
|
|
|
return app |
|
|
|
return app |
|
|
|
|
|
|
|
|
|
|
|