1
0
mirror of https://github.com/gryf/ebook-converter.git synced 2026-04-20 21:21:35 +02:00

Finalizing logging transition.

This commit is contained in:
2021-06-24 20:31:37 +02:00
parent 230fe90e69
commit 0a9536b180
16 changed files with 74 additions and 94 deletions
@@ -444,8 +444,8 @@ class Indexer(object): # {{{
if self.is_periodical and self.masthead_offset is None:
raise ValueError('Periodicals must have a masthead')
self.log('Generating MOBI index for a %s'%('periodical' if
self.is_periodical else 'book'))
self.log('Generating MOBI index for a %s', 'periodical' if
self.is_periodical else 'book')
self.is_flat_periodical = False
if self.is_periodical:
periodical_node = next(iter(oeb.toc))
@@ -634,8 +634,8 @@ class Indexer(object): # {{{
offset = id_offsets[node.href]
label = self.cncx[node.title]
except:
self.log.warn('TOC item %s [%s] not found in document'%(
node.title, node.href))
self.log.warn('TOC item %s [%s] not found in document',
node.title, node.href)
continue
if offset in seen:
+1 -5
View File
@@ -12,10 +12,6 @@ from ebook_converter.ebooks.mobi.utils import (encint, encode_trailing_data,
from ebook_converter.ebooks.mobi.writer2.indexer import Indexer
__license__ = 'GPL v3'
__copyright__ = '2011, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
# Disabled as I dont care about uncrossable breaks
WRITE_UNCROSSABLE_BREAKS = False
NULL_INDEX = 0xffffffff
@@ -89,7 +85,7 @@ class MobiWriter(object):
def generate_index(self):
self.primary_index_record_idx = None
if self.oeb.toc.count() < 1:
self.log.warn('No TOC, MOBI index not generated')
self.log.warning('No TOC, MOBI index not generated')
return
try:
self.indexer = Indexer(self.serializer, self.last_text_record_idx,
@@ -97,7 +97,7 @@ class Resources(object):
try:
data = self.process_image(item.data)
except:
self.log.warn('Bad image file %r' % item.href)
self.log.warning('Bad image file %r', item.href)
continue
else:
if mh_href and item.href == mh_href:
@@ -117,7 +117,7 @@ class Resources(object):
data = rescale_image(item.data, dimen=MAX_THUMB_DIMEN,
maxsizeb=MAX_THUMB_SIZE)
except:
self.log.warn('Failed to generate thumbnail')
self.log.warning('Failed to generate thumbnail')
else:
self.image_indices.add(len(self.records))
self.records.append(data)
@@ -145,7 +145,7 @@ class Resources(object):
try:
data = self.process_image(item.data)
except:
self.log.warn('Bad image file %r' % item.href)
self.log.warning('Bad image file %r', item.href)
else:
self.records.append(data)
self.item_map[item.href] = len(self.records)
@@ -380,7 +380,7 @@ class Serializer(object):
is_start = (href and href == start_href)
# Iterate over all filepos items
if href not in id_offsets:
self.logger.warn('Hyperlink target %r not found' % href)
self.logger.warning('Hyperlink target %r not found', href)
# Link to the top of the document, better than just ignoring
href, _ = urllib.parse.urldefrag(href)
if href in self.id_offsets: