show wkhtmltopdf output when logging verbose

This commit is contained in:
Jake Howard 2017-05-11 09:00:40 +01:00
parent b01532e7d3
commit 851a215762

View file

@ -4,6 +4,7 @@ from md_pdf.build.cover import OUTPUT_COVER_FILE
import os import os
import logging import logging
logger = logging.getLogger(__file__) logger = logging.getLogger(__file__)
@ -14,7 +15,6 @@ STYLE_FILE = os.path.join(STATIC_DIR, 'style.css')
HEADER_FILE = os.path.join(TEMPLATES_DIR, 'header.html') HEADER_FILE = os.path.join(TEMPLATES_DIR, 'header.html')
FOOTER_FILE = os.path.join(TEMPLATES_DIR, 'footer.html') FOOTER_FILE = os.path.join(TEMPLATES_DIR, 'footer.html')
PDF_OPTIONS = { PDF_OPTIONS = {
"quiet": "",
"no-pdf-compression": "", "no-pdf-compression": "",
"enable-internal-links": "", "enable-internal-links": "",
@ -28,6 +28,8 @@ PDF_OPTIONS = {
def export_pdf(content, config): def export_pdf(content, config):
if logger.getEffectiveLevel() > logging.DEBUG:
PDF_OPTIONS['quiet'] = ""
PDF_OPTIONS['title'] = config.get('title', 'Output') PDF_OPTIONS['title'] = config.get('title', 'Output')
PDF_OPTIONS['replace'] = [(key, str(value)) for key, value in config['context'].items()] PDF_OPTIONS['replace'] = [(key, str(value)) for key, value in config['context'].items()]