1
0
mirror of https://github.com/janeczku/calibre-web synced 2025-11-04 17:23:18 +00:00

Ship config.ini with defaults; log errors to file; fix OPDS catalog name

This commit is contained in:
JanB
2016-04-15 18:23:00 +02:00
parent b99c793aa2
commit 952d389dc5
8 changed files with 46 additions and 25 deletions

View File

@@ -3,6 +3,7 @@
import mimetypes
import logging
from logging.handlers import RotatingFileHandler
import sys
import textwrap
mimetypes.add_type('application/xhtml+xml','.xhtml')
@@ -32,13 +33,12 @@ from shutil import copyfile
app = (Flask(__name__))
# Log only in production mode.
#if not app.debug:
file_handler = logging.StreamHandler(sys.stdout)
formatter = logging.Formatter(
"[%(asctime)s] {%(pathname)s:%(lineno)d} %(levelname)s - %(message)s")
file_handler = RotatingFileHandler(os.path.join(config.LOG_DIR, "calibre-web.log"), maxBytes=10000, backupCount=1)
file_handler.setLevel(logging.INFO)
file_handler.setFormatter(formatter)
app.logger.addHandler(file_handler)
app.logger_name = 'calibre web'
app.logger.setLevel(logging.INFO)
app.logger.info('Starting Calibre Web...')
Principal(app)