diff options
author | Bryan Brattlof <hello@bryanbrattlof.com> | 2021-03-01 13:08:31 -0500 |
---|---|---|
committer | Bryan Brattlof <hello@bryanbrattlof.com> | 2021-03-01 13:18:58 -0500 |
commit | 9dda7325eb4d6a91200baf0ecc3e304292ea3ba0 (patch) | |
tree | e22871aaf14fba30f083afcc9edf7e8a8c0450b7 | |
parent | 41de270bc1f7b6fa369590a562358b0e2d0bb6f8 (diff) | |
download | pelican-htmlmin-9dda7325eb4d6a91200baf0ecc3e304292ea3ba0.tar.gz pelican-htmlmin-9dda7325eb4d6a91200baf0ecc3e304292ea3ba0.tar.bz2 |
add plugin name to logging statements
to make grepping log files more pleasant, this commit will add
'htmlmin: ' to every log event emitted by the plugin.
-rw-r--r-- | pelican/plugins/htmlmin/minify.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/pelican/plugins/htmlmin/minify.py b/pelican/plugins/htmlmin/minify.py index 10e8a4c..ce8c199 100644 --- a/pelican/plugins/htmlmin/minify.py +++ b/pelican/plugins/htmlmin/minify.py @@ -23,6 +23,8 @@ def run(pelican): 'remove_comments': True, 'remove_all_empty_space': True, 'remove_optional_attribute_quotes': False}) + for key, value in options.items(): + logger.debug('htmlmin: using option: %s = %s', key, value) htmlfile = re.compile( pelican.settings.get('HTMLMIN_MATCH', r'.html?$')) @@ -45,12 +47,13 @@ def worker(filepath, options): rawhtml = page.read() with open(filepath, 'w', encoding='utf-8') as page: - logger.debug('Minifying: %s', filepath) + logger.debug('htmlmin: Minifying %s', filepath) try: compressed = htmlmin.minify(rawhtml, **options) page.write(compressed) except Exception as e: - logger.critical('Minification failed: %s', e) + logger.critical('htmlmin: Failed to minify %s: %s', + filepath, e) def register(): |