From 6dfcaea2dd14626243b505b209c5be787bf91267 Mon Sep 17 00:00:00 2001 From: gryf Date: Thu, 24 Jun 2021 19:42:51 +0200 Subject: [PATCH] Next portion of logging adapt. --- ebook_converter/css_selectors/tests.py | 17 +++++------ ebook_converter/customize/conversion.py | 4 +-- ebook_converter/devices/interface.py | 6 +--- .../ebooks/conversion/plugins/chm_input.py | 8 +++--- .../ebooks/conversion/plugins/comic_input.py | 7 +---- .../ebooks/conversion/plugins/fb2_input.py | 4 +-- .../ebooks/conversion/plugins/fb2_output.py | 8 ++---- .../ebooks/conversion/plugins/html_input.py | 22 +++++++-------- .../ebooks/conversion/plugins/html_output.py | 2 +- .../ebooks/conversion/plugins/htmlz_input.py | 4 +-- .../ebooks/conversion/plugins/lit_input.py | 4 +-- .../ebooks/conversion/plugins/mobi_input.py | 7 +---- .../ebooks/conversion/plugins/mobi_output.py | 23 +++++++-------- .../ebooks/conversion/plugins/oeb_output.py | 18 +++++++----- .../ebooks/conversion/plugins/pdb_input.py | 4 +-- .../ebooks/conversion/plugins/pml_input.py | 7 +---- .../ebooks/conversion/plugins/recipe_input.py | 18 ++++++------ .../ebooks/conversion/plugins/rtf_input.py | 16 +++++------ .../ebooks/conversion/plugins/snb_output.py | 28 +++++++++---------- .../ebooks/conversion/plugins/txt_input.py | 20 ++++++++----- 20 files changed, 105 insertions(+), 122 deletions(-) diff --git a/ebook_converter/css_selectors/tests.py b/ebook_converter/css_selectors/tests.py index d77cb5a..ed43f1f 100644 --- a/ebook_converter/css_selectors/tests.py +++ b/ebook_converter/css_selectors/tests.py @@ -1,16 +1,17 @@ -import unittest, sys, argparse +import argparse +import sys +import unittest -from lxml import etree, html +from lxml import etree +from lxml import html -from ebook_converter.css_selectors.errors import SelectorSyntaxError, ExpressionError -from ebook_converter.css_selectors.parser import tokenize, parse +from ebook_converter.css_selectors.errors import ExpressionError +from ebook_converter.css_selectors.errors import SelectorSyntaxError +from ebook_converter.css_selectors.parser import parse +from ebook_converter.css_selectors.parser import tokenize from ebook_converter.css_selectors.select import Select -__license__ = 'GPL v3' -__copyright__ = '2015, Kovid Goyal ' - - class TestCSSSelectors(unittest.TestCase): # Test data {{{ diff --git a/ebook_converter/customize/conversion.py b/ebook_converter/customize/conversion.py index 9884070..cf01d66 100644 --- a/ebook_converter/customize/conversion.py +++ b/ebook_converter/customize/conversion.py @@ -197,9 +197,9 @@ class InputFormatPlugin(Plugin): def __call__(self, stream, options, file_ext, log, accelerators, output_dir): try: - log('InputFormatPlugin: %s running'%self.name) + log.info('InputFormatPlugin: %s running', self.name) if hasattr(stream, 'name'): - log('on', stream.name) + log.info('on: %s', stream.name) except: # In case stdout is broken pass diff --git a/ebook_converter/devices/interface.py b/ebook_converter/devices/interface.py index 7e3df92..2f47518 100644 --- a/ebook_converter/devices/interface.py +++ b/ebook_converter/devices/interface.py @@ -4,10 +4,6 @@ from collections import namedtuple from ebook_converter.customize import Plugin -__license__ = 'GPL v3' -__copyright__ = '2008, Kovid Goyal ' - - class DevicePlugin(Plugin): """ Defines the interface that should be implemented by backends that @@ -16,7 +12,7 @@ class DevicePlugin(Plugin): type = 'Device interface' #: Ordered list of supported formats - FORMATS = ["lrf", "rtf", "pdf", "txt"] + FORMATS = ["lrf", "rtf", "pdf", "txt"] # If True, the config dialog will not show the formats box HIDE_FORMATS_CONFIG_BOX = False diff --git a/ebook_converter/ebooks/conversion/plugins/chm_input.py b/ebook_converter/ebooks/conversion/plugins/chm_input.py index 564d8d0..493427b 100644 --- a/ebook_converter/ebooks/conversion/plugins/chm_input.py +++ b/ebook_converter/ebooks/conversion/plugins/chm_input.py @@ -28,7 +28,7 @@ class CHMInput(InputFormatPlugin): from ebook_converter.ebooks.chm.reader import CHMReader log.debug('Opening CHM file') rdr = CHMReader(chm_path, log, input_encoding=self.opts.input_encoding) - log.debug('Extracting CHM to %s' % output_dir) + log.debug('Extracting CHM to %s', output_dir) rdr.extract_content(output_dir, debug_dump=debug_dump) self._chm_reader = rdr return rdr.hhc_path @@ -53,8 +53,8 @@ class CHMInput(InputFormatPlugin): # closing stream so CHM can be opened by external library stream.close() - log.debug('tdir=%s' % tdir) - log.debug('stream.name=%s' % stream.name) + log.debug('tdir=%s', tdir) + log.debug('stream.name=%s', stream.name) debug_dump = False odi = options.debug_pipeline if odi: @@ -121,7 +121,7 @@ class CHMInput(InputFormatPlugin): resolve_entities=True)[0] hhcroot = html.fromstring(hhcdata) toc = self._process_nodes(hhcroot) - log.debug('Found %d section nodes' % toc.count()) + log.debug('Found %d section nodes', toc.count()) htmlpath = os.path.splitext(hhcpath)[0] + ".html" base = os.path.dirname(os.path.abspath(htmlpath)) diff --git a/ebook_converter/ebooks/conversion/plugins/comic_input.py b/ebook_converter/ebooks/conversion/plugins/comic_input.py index 15e1d08..c3cf254 100644 --- a/ebook_converter/ebooks/conversion/plugins/comic_input.py +++ b/ebook_converter/ebooks/conversion/plugins/comic_input.py @@ -9,11 +9,6 @@ from ebook_converter.ptempfile import PersistentTemporaryDirectory from ebook_converter.utils import directory -__license__ = 'GPL v3' -__copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net' -__docformat__ = 'restructuredtext en' - - class ComicInput(InputFormatPlugin): name = 'Comic Input' @@ -152,7 +147,7 @@ class ComicInput(InputFormatPlugin): self.log.warning('Could not process the following pages ' '(run with --verbose to see why):') for f in failures: - self.log.warning('\t', f) + self.log.warning('\t%s', f) if not new_pages: raise ValueError('Could not find any valid pages in comic: %s' % comic) diff --git a/ebook_converter/ebooks/conversion/plugins/fb2_input.py b/ebook_converter/ebooks/conversion/plugins/fb2_input.py index 09da836..93ab23a 100644 --- a/ebook_converter/ebooks/conversion/plugins/fb2_input.py +++ b/ebook_converter/ebooks/conversion/plugins/fb2_input.py @@ -90,7 +90,7 @@ class FB2Input(InputFormatPlugin): ss = f.read() ss = ss.replace("__FB_NS__", fb_ns) if options.no_inline_fb2_toc: - log('Disabling generation of inline FB2 TOC') + log.info('Disabling generation of inline FB2 TOC') ss = re.compile(r'.*', re.DOTALL).sub('', ss) @@ -180,7 +180,7 @@ class FB2Input(InputFormatPlugin): data = base64_decode(raw) except TypeError: self.log.exception('Binary data with id=%s is corrupted, ' - 'ignoring' % elem.get('id')) + 'ignoring', elem.get('id')) else: with open(fname, 'wb') as f: f.write(data) diff --git a/ebook_converter/ebooks/conversion/plugins/fb2_output.py b/ebook_converter/ebooks/conversion/plugins/fb2_output.py index 64fa9f6..0f2971c 100644 --- a/ebook_converter/ebooks/conversion/plugins/fb2_output.py +++ b/ebook_converter/ebooks/conversion/plugins/fb2_output.py @@ -3,11 +3,6 @@ import os from ebook_converter.customize.conversion import OutputFormatPlugin, OptionRecommendation -__license__ = 'GPL 3' -__copyright__ = '2009, John Schember ' -__docformat__ = 'restructuredtext en' - - class FB2Output(OutputFormatPlugin): name = 'FB2 Output' @@ -177,7 +172,8 @@ class FB2Output(OutputFormatPlugin): rasterizer = SVGRasterizer() rasterizer(oeb_book, opts) except Unavailable: - log.warn('SVG rasterizer unavailable, SVG will not be converted') + log.warning('SVG rasterizer unavailable, SVG will not be ' + 'converted') linearize_jacket(oeb_book) diff --git a/ebook_converter/ebooks/conversion/plugins/html_input.py b/ebook_converter/ebooks/conversion/plugins/html_input.py index d6f0481..05571e5 100644 --- a/ebook_converter/ebooks/conversion/plugins/html_input.py +++ b/ebook_converter/ebooks/conversion/plugins/html_input.py @@ -101,7 +101,7 @@ class HTMLInput(InputFormatPlugin): if not metadata.language: l = canonicalize_lang(getattr(opts, 'language', None)) if not l: - oeb.logger.warn('Language not specified') + oeb.logger.warning('Language not specified') l = get_lang().replace('_', '-') metadata.add('language', l) if not metadata.creator: @@ -109,12 +109,12 @@ class HTMLInput(InputFormatPlugin): if a: a = string_to_authors(a) if not a: - oeb.logger.warn('Creator not specified') + oeb.logger.warning('Creator not specified') a = [self.oeb.translate('Unknown')] for aut in a: metadata.add('creator', aut) if not metadata.title: - oeb.logger.warn('Title not specified') + oeb.logger.warning('Title not specified') metadata.add('title', self.oeb.translate('Unknown')) bookid = str(uuid.uuid4()) metadata.add('identifier', bookid, id='uuid_id', scheme='uuid') @@ -141,14 +141,14 @@ class HTMLInput(InputFormatPlugin): self.added_resources = {} self.log = log - self.log('Normalizing filename cases') + self.log.info('Normalizing filename cases') for path, href in htmlfile_map.items(): self.added_resources[path] = href self.urlnormalize, self.DirContainer = urlnormalize, DirContainer self.urldefrag = urllib.parse.urldefrag self.BINARY_MIME = BINARY_MIME - self.log('Rewriting HTML links') + self.log.info('Rewriting HTML links') for f in filelist: path = f.path dpath = os.path.dirname(path) @@ -208,12 +208,12 @@ class HTMLInput(InputFormatPlugin): try: link_ = link_.decode('utf-8', 'error') except: - self.log.warn('Failed to decode link %r. Ignoring'%link_) + self.log.warning('Failed to decode link %r. Ignoring', link_) return None, None try: l = Link(link_, base if base else os.getcwd()) except: - self.log.exception('Failed to process link: %r'%link_) + self.log.exception('Failed to process link: %r', link_) return None, None if l.path is None: # Not a local resource @@ -237,7 +237,7 @@ class HTMLInput(InputFormatPlugin): if not os.access(link, os.R_OK): return link_ if os.path.isdir(link): - self.log.warn(link_, 'is a link to a directory. Ignoring.') + self.log.warning(link_, 'is a link to a directory. Ignoring.') return link_ if link not in self.added_resources: bhref = os.path.basename(link) @@ -245,7 +245,7 @@ class HTMLInput(InputFormatPlugin): guessed = mimetypes.guess_type(href)[0] media_type = guessed or self.BINARY_MIME if media_type == 'text/plain': - self.log.warn('Ignoring link to text file %r'%link_) + self.log.warning('Ignoring link to text file %r', link_) return None if media_type == self.BINARY_MIME: # Check for the common case, images @@ -257,7 +257,7 @@ class HTMLInput(InputFormatPlugin): if img: media_type = mimetypes.guess_type('dummy.'+img)[0] or self.BINARY_MIME - self.oeb.log.debug('Added', link) + self.oeb.log.debug('Added %s', link) self.oeb.container = self.DirContainer(os.path.dirname(link), self.oeb.log, ignore_opf=True) # Load into memory @@ -287,6 +287,6 @@ class HTMLInput(InputFormatPlugin): raw = f.read().decode('utf-8', 'replace') raw = self.oeb.css_preprocessor(raw, add_namespace=False) except: - self.log.exception('Failed to read CSS file: %r'%link) + self.log.exception('Failed to read CSS file: %r', link) return (None, None) return (None, raw) diff --git a/ebook_converter/ebooks/conversion/plugins/html_output.py b/ebook_converter/ebooks/conversion/plugins/html_output.py index 51121df..76311ef 100644 --- a/ebook_converter/ebooks/conversion/plugins/html_output.py +++ b/ebook_converter/ebooks/conversion/plugins/html_output.py @@ -228,7 +228,7 @@ class HTMLOutput(OutputFormatPlugin): shutil.rmtree(opts.extract_to) os.makedirs(opts.extract_to) zfile.extractall(opts.extract_to) - self.log('Zip file extracted to', opts.extract_to) + self.log.info('Zip file extracted to %s', opts.extract_to) zfile.close() diff --git a/ebook_converter/ebooks/conversion/plugins/htmlz_input.py b/ebook_converter/ebooks/conversion/plugins/htmlz_input.py index 6f465f0..27e54c7 100644 --- a/ebook_converter/ebooks/conversion/plugins/htmlz_input.py +++ b/ebook_converter/ebooks/conversion/plugins/htmlz_input.py @@ -55,8 +55,8 @@ class HTMLZInput(InputFormatPlugin): # HTMLZ archive probably won't turn out as the user expects. With # Multiple HTML files ZIP input should be used in place of HTMLZ. if multiple_html: - log.warn('Multiple HTML files found in the archive. Only %s will ' - 'be used.' % index) + log.warning('Multiple HTML files found in the archive. Only %s ' + 'will be used.', index) if index: with open(index, 'rb') as tf: diff --git a/ebook_converter/ebooks/conversion/plugins/lit_input.py b/ebook_converter/ebooks/conversion/plugins/lit_input.py index 446af67..e14991e 100644 --- a/ebook_converter/ebooks/conversion/plugins/lit_input.py +++ b/ebook_converter/ebooks/conversion/plugins/lit_input.py @@ -40,8 +40,8 @@ class LITInput(InputFormatPlugin): from ebook_converter.ebooks.txt.processor import \ convert_basic, separate_paragraphs_single_line from ebook_converter.ebooks.chardet import xml_to_unicode - self.log('LIT file with all text in singe
 tag '
-                             'detected')
+                    self.log.info('LIT file with all text in singe 
 tag '
+                                  'detected')
                     html = separate_paragraphs_single_line(pre.text)
                     html = convert_basic(html).replace('',
                                                        '' %
diff --git a/ebook_converter/ebooks/conversion/plugins/mobi_input.py b/ebook_converter/ebooks/conversion/plugins/mobi_input.py
index e4cdbb2..47bb245 100644
--- a/ebook_converter/ebooks/conversion/plugins/mobi_input.py
+++ b/ebook_converter/ebooks/conversion/plugins/mobi_input.py
@@ -3,11 +3,6 @@ import os
 from ebook_converter.customize.conversion import InputFormatPlugin
 
 
-__license__ = 'GPL 3'
-__copyright__ = '2009, Kovid Goyal '
-__docformat__ = 'restructuredtext en'
-
-
 class MOBIInput(InputFormatPlugin):
 
     name        = 'MOBI Input'
@@ -37,7 +32,7 @@ class MOBIInput(InputFormatPlugin):
                 mr.extract_content('.', parse_cache)
 
         if mr.kf8_type is not None:
-            log('Found KF8 MOBI of type %r'%mr.kf8_type)
+            log.info('Found KF8 MOBI of type %r', mr.kf8_type)
             if mr.kf8_type == 'joint':
                 self.mobi_is_joint = True
             from ebook_converter.ebooks.mobi.reader.mobi8 import Mobi8Reader
diff --git a/ebook_converter/ebooks/conversion/plugins/mobi_output.py b/ebook_converter/ebooks/conversion/plugins/mobi_output.py
index acaf29f..c17fc30 100644
--- a/ebook_converter/ebooks/conversion/plugins/mobi_output.py
+++ b/ebook_converter/ebooks/conversion/plugins/mobi_output.py
@@ -2,11 +2,6 @@ from ebook_converter.customize.conversion import (OutputFormatPlugin,
         OptionRecommendation)
 
 
-__license__ = 'GPL v3'
-__copyright__ = '2009, Kovid Goyal '
-__docformat__ = 'restructuredtext en'
-
-
 def remove_html_cover(oeb, log):
     from ebook_converter.ebooks.oeb.base import OEB_DOCS
 
@@ -17,10 +12,10 @@ def remove_html_cover(oeb, log):
     del oeb.guide['cover']
     item = oeb.manifest.hrefs[href]
     if item.spine_position is not None:
-        log.warn('Found an HTML cover: ', item.href, 'removing it.',
-                'If you find some content missing from the output MOBI, it '
-                'is because you misidentified the HTML cover in the input '
-                'document')
+        log.warning('Found an HTML cover: %s', 'removing it. If you find some '
+                    'content missing from the output MOBI, it is because you '
+                    'misidentified the HTML cover in the input document',
+                    item.href)
         oeb.spine.remove(item)
         if item.media_type in OEB_DOCS:
             oeb.manifest.remove(item)
@@ -117,7 +112,8 @@ class MOBIOutput(OutputFormatPlugin):
         found = 'masthead' in self.oeb.guide
         if not found:
             from ebook_converter.ebooks import generate_masthead
-            self.oeb.log.debug('No masthead found in manifest, generating default mastheadImage...')
+            self.oeb.log.debug('No masthead found in manifest, generating '
+                               'default mastheadImage...')
             raw = generate_masthead(str(self.oeb.metadata['title'][0]))
             id, href = self.oeb.manifest.generate('masthead', 'masthead')
             self.oeb.manifest.add(id, href, 'image/gif', data=raw)
@@ -132,7 +128,7 @@ class MOBIOutput(OutputFormatPlugin):
             return
         if toc and toc[0].klass != 'periodical':
             one, two = self.oeb.spine[0], self.oeb.spine[1]
-            self.log('Converting TOC for MOBI periodical indexing...')
+            self.log.info('Converting TOC for MOBI periodical indexing...')
 
             articles = {}
             if toc.depth() < 3:
@@ -206,7 +202,7 @@ class MOBIOutput(OutputFormatPlugin):
             extract_mobi(output_path, opts)
             return
 
-        self.log('Creating MOBI 6 output')
+        self.log.info('Creating MOBI 6 output')
         self.write_mobi(input_plugin, output_path, kf8, resources)
 
     def create_kf8(self, resources, for_joint=False):
@@ -232,7 +228,8 @@ class MOBIOutput(OutputFormatPlugin):
             rasterizer = SVGRasterizer()
             rasterizer(oeb, opts)
         except Unavailable:
-            self.log.warn('SVG rasterizer unavailable, SVG will not be converted')
+            self.log.warning('SVG rasterizer unavailable, SVG will not be '
+                             'converted')
         else:
             # Add rasterized SVG images
             resources.add_extra_images()
diff --git a/ebook_converter/ebooks/conversion/plugins/oeb_output.py b/ebook_converter/ebooks/conversion/plugins/oeb_output.py
index e8679c6..e68d8aa 100644
--- a/ebook_converter/ebooks/conversion/plugins/oeb_output.py
+++ b/ebook_converter/ebooks/conversion/plugins/oeb_output.py
@@ -34,13 +34,16 @@ class OEBOutput(OutputFormatPlugin):
                         try:
                             self.workaround_nook_cover_bug(root)
                         except:
-                            self.log.exception('Something went wrong while trying to'
-                                    ' workaround Nook cover bug, ignoring')
+                            self.log.exception('Something went wrong while '
+                                               'trying to workaround Nook '
+                                               'cover bug, ignoring')
                         try:
                             self.workaround_pocketbook_cover_bug(root)
                         except:
-                            self.log.exception('Something went wrong while trying to'
-                                    ' workaround Pocketbook cover bug, ignoring')
+                            self.log.exception('Something went wrong while '
+                                               'trying to workaround '
+                                               'Pocketbook cover bug, '
+                                               'ignoring')
                         self.migrate_lang_code(root)
                     raw = etree.tostring(root, pretty_print=True,
                             encoding='utf-8', xml_declaration=True)
@@ -80,9 +83,10 @@ class OEBOutput(OutputFormatPlugin):
                 manifest_item = manifest_items_with_id(covid)
                 if len(manifest_item) == 1 and \
                         manifest_item[0].get('media-type',
-                                '').startswith('image/'):
-                    self.log.warn('The cover image has an id != "cover". Renaming'
-                            ' to work around bug in Nook Color')
+                                             '').startswith('image/'):
+                    self.log.warning('The cover image has an id != "cover". '
+                                     'Renaming to work around bug in Nook '
+                                     'Color')
 
                     from ebook_converter.ebooks.oeb.base import uuid_id
                     newid = uuid_id()
diff --git a/ebook_converter/ebooks/conversion/plugins/pdb_input.py b/ebook_converter/ebooks/conversion/plugins/pdb_input.py
index e9c722d..3d58893 100644
--- a/ebook_converter/ebooks/conversion/plugins/pdb_input.py
+++ b/ebook_converter/ebooks/conversion/plugins/pdb_input.py
@@ -25,8 +25,8 @@ class PDBInput(InputFormatPlugin):
                            (header.ident,
                             IDENTITY_TO_NAME.get(header.ident, 'Unknown')))
 
-        log.debug('Detected ebook format as: %s with identity: %s' %
-                  (IDENTITY_TO_NAME[header.ident], header.ident))
+        log.debug('Detected ebook format as: %s with identity: %s',
+                  IDENTITY_TO_NAME[header.ident], header.ident)
 
         reader = Reader(header, stream, log, options)
         opf = reader.extract_content(os.getcwd())
diff --git a/ebook_converter/ebooks/conversion/plugins/pml_input.py b/ebook_converter/ebooks/conversion/plugins/pml_input.py
index 6af84ed..c026d84 100644
--- a/ebook_converter/ebooks/conversion/plugins/pml_input.py
+++ b/ebook_converter/ebooks/conversion/plugins/pml_input.py
@@ -6,11 +6,6 @@ from ebook_converter.customize.conversion import InputFormatPlugin
 from ebook_converter.ptempfile import TemporaryDirectory
 
 
-__license__ = 'GPL v3'
-__copyright__ = '2009, John Schember '
-__docformat__ = 'restructuredtext en'
-
-
 class PMLInput(InputFormatPlugin):
 
     name        = 'PML Input'
@@ -107,7 +102,7 @@ class PMLInput(InputFormatPlugin):
                     html_path = os.path.join(os.getcwd(), html_name)
 
                     pages.append(html_name)
-                    log.debug('Processing PML item %s...' % pml)
+                    log.debug('Processing PML item %s...', pml)
                     ttoc = self.process_pml(pml, html_path)
                     toc += ttoc
                 images = self.get_images(stream, tdir, True)
diff --git a/ebook_converter/ebooks/conversion/plugins/recipe_input.py b/ebook_converter/ebooks/conversion/plugins/recipe_input.py
index 13f3fe1..b467ee2 100644
--- a/ebook_converter/ebooks/conversion/plugins/recipe_input.py
+++ b/ebook_converter/ebooks/conversion/plugins/recipe_input.py
@@ -63,7 +63,7 @@ class RecipeInput(InputFormatPlugin):
             if os.environ.get('CALIBRE_RECIPE_URN'):
                 from ebook_converter.web.feeds.recipes.collection import get_custom_recipe, get_builtin_recipe_by_id
                 urn = os.environ['CALIBRE_RECIPE_URN']
-                log('Downloading recipe urn: ' + urn)
+                log.info('Downloading recipe urn: %s', urn)
                 rtype, recipe_id = urn.partition(':')[::2]
                 if not recipe_id:
                     raise ValueError('Invalid recipe urn: ' + urn)
@@ -80,7 +80,7 @@ class RecipeInput(InputFormatPlugin):
                 with open(recipe_or_file, 'rb') as f:
                     self.recipe_source = f.read()
                 recipe = compile_recipe(self.recipe_source)
-                log('Using custom recipe')
+                log.info('Using custom recipe')
             else:
                 from ebook_converter.web.feeds.recipes.collection import (
                         get_builtin_recipe_by_title, get_builtin_recipe_titles)
@@ -98,16 +98,16 @@ class RecipeInput(InputFormatPlugin):
                     recipe = compile_recipe(raw)
                     self.recipe_source = raw
                     if recipe.requires_version > numeric_version:
-                        log.warn(
-                        'Downloaded recipe needs calibre version at least: %s' %
-                        ('.'.join(recipe.requires_version)))
+                        log.warning('Downloaded recipe needs calibre version '
+                                    'at least: %s',
+                                    '.'.join(recipe.requires_version))
                         builtin = True
                 except:
-                    log.exception('Failed to compile downloaded recipe. Falling '
-                            'back to builtin one')
+                    log.exception('Failed to compile downloaded recipe. '
+                                  'Falling back to builtin one')
                     builtin = True
                 if builtin:
-                    log('Using bundled builtin recipe')
+                    log.info('Using bundled builtin recipe')
                     raw = get_builtin_recipe_by_title(title, log=log,
                             download_recipe=False)
                     if raw is None:
@@ -115,7 +115,7 @@ class RecipeInput(InputFormatPlugin):
                     recipe = compile_recipe(raw)
                     self.recipe_source = raw
                 else:
-                    log('Using downloaded builtin recipe')
+                    log.info('Using downloaded builtin recipe')
 
             if recipe is None:
                 raise ValueError('%r is not a valid recipe file or builtin recipe' %
diff --git a/ebook_converter/ebooks/conversion/plugins/rtf_input.py b/ebook_converter/ebooks/conversion/plugins/rtf_input.py
index c2d36fc..f6e0753 100644
--- a/ebook_converter/ebooks/conversion/plugins/rtf_input.py
+++ b/ebook_converter/ebooks/conversion/plugins/rtf_input.py
@@ -64,9 +64,9 @@ class RTFInput(InputFormatPlugin):
                 debug_dir = u'rtfdebug'
                 run_lev = 4
                 indent_out = 1
-                self.log('Running RTFParser in debug mode')
+                self.log.info('Running RTFParser in debug mode')
             except Exception:
-                self.log.warn('Impossible to run RTFParser in debug mode')
+                self.log.warning('Impossible to run RTFParser in debug mode')
         parser = ParseRtf(
             in_file=stream,
             out_file=ofile,
@@ -122,7 +122,7 @@ class RTFInput(InputFormatPlugin):
     def extract_images(self, picts):
         from ebook_converter.utils.imghdr import what
         from binascii import unhexlify
-        self.log('Extracting images...')
+        self.log.info('Extracting images...')
 
         with open(picts, 'rb') as f:
             raw = f.read()
@@ -154,7 +154,7 @@ class RTFInput(InputFormatPlugin):
             try:
                 imap[count] = self.convert_image(val)
             except Exception:
-                self.log.exception('Failed to convert', val)
+                self.log.exception('Failed to convert %s', val)
         return imap
 
     def convert_image(self, name):
@@ -163,7 +163,7 @@ class RTFInput(InputFormatPlugin):
         try:
             return self.rasterize_wmf(name)
         except Exception:
-            self.log.exception('Failed to convert WMF image %r' % name)
+            self.log.exception('Failed to convert WMF image %r', name)
         return self.replace_wmf(name)
 
     def replace_wmf(self, name):
@@ -258,7 +258,7 @@ class RTFInput(InputFormatPlugin):
         from ebook_converter.ebooks.rtf.input import InlineClass
         self.opts = options
         self.log = log
-        self.log('Converting RTF to XML...')
+        self.log.info('Converting RTF to XML...')
         try:
             xml = self.generate_xml(stream.name)
         except RtfInvalidCodeException as e:
@@ -275,7 +275,7 @@ class RTFInput(InputFormatPlugin):
             except Exception:
                 self.log.exception('Failed to extract images...')
 
-        self.log('Parsing XML...')
+        self.log.info('Parsing XML...')
         doc = etree.fromstring(xml)
         border_styles = self.convert_borders(doc)
         for pict in doc.xpath('//rtf:pict[@num]',
@@ -286,7 +286,7 @@ class RTFInput(InputFormatPlugin):
             if name is not None:
                 pict.set('num', name)
 
-        self.log('Converting XML to HTML...')
+        self.log.info('Converting XML to HTML...')
         inline_class = InlineClass(self.log)
         with open(pkg_resources.resource_filename('ebook_converter',
                                                   'data/rtf.xsl')) as fobj:
diff --git a/ebook_converter/ebooks/conversion/plugins/snb_output.py b/ebook_converter/ebooks/conversion/plugins/snb_output.py
index af3dcff..92d891e 100644
--- a/ebook_converter/ebooks/conversion/plugins/snb_output.py
+++ b/ebook_converter/ebooks/conversion/plugins/snb_output.py
@@ -5,11 +5,6 @@ from ebook_converter.ptempfile import TemporaryDirectory
 from ebook_converter.constants_old import __appname__, __version__
 
 
-__license__ = 'GPL 3'
-__copyright__ = '2010, Li Fanxi '
-__docformat__ = 'restructuredtext en'
-
-
 class SNBOutput(OutputFormatPlugin):
 
     name = 'SNB Output'
@@ -57,7 +52,8 @@ class SNBOutput(OutputFormatPlugin):
             rasterizer = SVGRasterizer()
             rasterizer(oeb_book, opts)
         except Unavailable:
-            log.warn('SVG rasterizer unavailable, SVG will not be converted')
+            log.warning('SVG rasterizer unavailable, SVG will not be '
+                        'converted')
 
         # Create temp dir
         with TemporaryDirectory('_snb_output') as tdir:
@@ -120,8 +116,8 @@ class SNBOutput(OutputFormatPlugin):
             tocBody = etree.SubElement(tocInfoTree, "body")
             outputFiles = {}
             if oeb_book.toc.count() == 0:
-                log.warn('This SNB file has no Table of Contents. '
-                    'Creating a default TOC')
+                log.warning('This SNB file has no Table of Contents. Creating '
+                            'a default TOC')
                 first = next(iter(oeb_book.spine))
                 oeb_book.toc.add('Start page', first.href)
             else:
@@ -141,7 +137,7 @@ class SNBOutput(OutputFormatPlugin):
                 if tocitem.href.find('#') != -1:
                     item = tocitem.href.split('#')
                     if len(item) != 2:
-                        log.error('Error in TOC item: %s' % tocitem)
+                        log.error('Error in TOC item: %s', tocitem)
                     else:
                         if item[0] in outputFiles:
                             outputFiles[item[0]].append((item[1], tocitem.title))
@@ -178,16 +174,18 @@ class SNBOutput(OutputFormatPlugin):
                 from ebook_converter.ebooks.oeb.base import OEB_DOCS, OEB_IMAGES
                 if m.hrefs[item.href].media_type in OEB_DOCS:
                     if item.href not in outputFiles:
-                        log.debug('File %s is unused in TOC. Continue in last chapter' % item.href)
+                        log.debug('File %s is unused in TOC. Continue in last '
+                                  'chapter', item.href)
                         mergeLast = True
                     else:
                         if oldTree is not None and mergeLast:
-                            log.debug('Output the modified chapter again: %s' % lastName)
+                            log.debug('Output the modified chapter again: %s',
+                                      lastName)
                             with open(os.path.join(snbcDir, lastName), 'wb') as f:
                                 f.write(etree.tostring(oldTree, pretty_print=True, encoding='utf-8'))
                             mergeLast = False
 
-                    log.debug('Converting %s to snbc...' % item.href)
+                    log.debug('Converting %s to snbc...', item.href)
                     snbwriter = SNBMLizer(log)
                     snbcTrees = None
                     if not mergeLast:
@@ -201,12 +199,12 @@ class SNBOutput(OutputFormatPlugin):
                             with open(os.path.join(snbcDir, lastName), 'wb') as f:
                                 f.write(etree.tostring(oldTree, pretty_print=True, encoding='utf-8'))
                     else:
-                        log.debug('Merge %s with last TOC item...' % item.href)
+                        log.debug('Merge %s with last TOC item...', item.href)
                         snbwriter.merge_content(oldTree, oeb_book, item,
                                                 [('', "Start")], opts)
 
             # Output the last one if needed
-            log.debug('Output the last modified chapter again: %s' % lastName)
+            log.debug('Output the last modified chapter again: %s', lastName)
             if oldTree is not None and mergeLast:
                 with open(os.path.join(snbcDir, lastName), 'wb') as f:
                     f.write(etree.tostring(oldTree, pretty_print=True, encoding='utf-8'))
@@ -214,7 +212,7 @@ class SNBOutput(OutputFormatPlugin):
 
             for item in m:
                 if m.hrefs[item.href].media_type in OEB_IMAGES:
-                    log.debug('Converting image: %s ...' % item.href)
+                    log.debug('Converting image: %s ...', item.href)
                     content = m.hrefs[item.href].data
                     # Convert & Resize image
                     self.HandleImage(content, os.path.join(snbiDir, ProcessFileName(item.href)))
diff --git a/ebook_converter/ebooks/conversion/plugins/txt_input.py b/ebook_converter/ebooks/conversion/plugins/txt_input.py
index 363e937..3352ca9 100644
--- a/ebook_converter/ebooks/conversion/plugins/txt_input.py
+++ b/ebook_converter/ebooks/conversion/plugins/txt_input.py
@@ -167,13 +167,14 @@ class TXTInput(InputFormatPlugin):
             if file_ext in {'md', 'textile', 'markdown'}:
                 options.formatting_type = {'md': 'markdown'}.get(file_ext, file_ext)
                 log.info('File extension indicates particular formatting. '
-                        'Forcing formatting type to: %s'%options.formatting_type)
+                         'Forcing formatting type to: %s',
+                         options.formatting_type)
                 options.paragraph_type = 'off'
 
         # Get the encoding of the document.
         if options.input_encoding:
             ienc = options.input_encoding
-            log.debug('Using user specified input encoding of %s' % ienc)
+            log.debug('Using user specified input encoding of %s', ienc)
         else:
             det_encoding = detect(txt[:4096])
             det_encoding, confidence = det_encoding['encoding'], det_encoding['confidence']
@@ -184,10 +185,12 @@ class TXTInput(InputFormatPlugin):
                 # gb2312 instead of gbk. gbk is a superset of gb2312, anyway.
                 det_encoding = 'gbk'
             ienc = det_encoding
-            log.debug('Detected input encoding as %s with a confidence of %s%%' % (ienc, confidence * 100))
+            log.debug('Detected input encoding as %s with a confidence of '
+                      '%s%%', ienc, confidence * 100)
         if not ienc:
             ienc = 'utf-8'
-            log.debug('No input encoding specified and could not auto detect using %s' % ienc)
+            log.debug('No input encoding specified and could not auto detect '
+                      'using %s', ienc)
         # Remove BOM from start of txt as its presence can confuse markdown
         import codecs
         for bom in (codecs.BOM_UTF16_LE, codecs.BOM_UTF16_BE, codecs.BOM_UTF8, codecs.BOM_UTF32_LE, codecs.BOM_UTF32_BE):
@@ -206,15 +209,18 @@ class TXTInput(InputFormatPlugin):
         if options.paragraph_type == 'auto':
             options.paragraph_type = detect_paragraph_type(txt)
             if options.paragraph_type == 'unknown':
-                log.debug('Could not reliably determine paragraph type using block')
+                log.debug('Could not reliably determine paragraph type using '
+                          'block')
                 options.paragraph_type = 'block'
             else:
-                log.debug('Auto detected paragraph type as %s' % options.paragraph_type)
+                log.debug('Auto detected paragraph type as %s',
+                          options.paragraph_type)
 
         # Detect formatting
         if options.formatting_type == 'auto':
             options.formatting_type = detect_formatting_type(txt)
-            log.debug('Auto detected formatting as %s' % options.formatting_type)
+            log.debug('Auto detected formatting as %s',
+                      options.formatting_type)
 
         if options.formatting_type == 'heuristic':
             setattr(options, 'enable_heuristics', True)