MediaFile: Use stock logging

This is part of the effort to separate MediaFile from beets (#1966). It avoids
using the beets-specific logging infrastructure. This commit is part of
fdebab657d6e85de56b3996e8fdece09796940ae from the new MediaFile repository.
This commit is contained in:
Adrian Sampson 2016-11-26 17:30:02 -05:00
parent cf5fa501e2
commit 692dea39e8

View file

@ -64,7 +64,7 @@ import six
__all__ = ['UnreadableFileError', 'FileTypeError', 'MediaFile']
log = logging.getLogger('beets')
log = logging.getLogger(__name__)
# Human-readable type names.
TYPES = {
@ -134,12 +134,12 @@ def mutagen_call(action, path, func, *args, **kwargs):
try:
return func(*args, **kwargs)
except mutagen.MutagenError as exc:
log.debug(u'{} failed: {}', action, six.text_type(exc))
log.debug(u'%s failed: %s', action, six.text_type(exc))
raise UnreadableFileError(path)
except Exception as exc:
# Isolate bugs in Mutagen.
log.debug(u'{}', traceback.format_exc())
log.error(u'uncaught Mutagen exception in {}: {}', action, exc)
log.debug(u'%s', traceback.format_exc())
log.error(u'uncaught Mutagen exception in %s: %s', action, exc)
raise MutagenError(path, exc)
@ -405,7 +405,7 @@ class Image(object):
try:
type = list(ImageType)[type]
except IndexError:
log.debug(u"ignoring unknown image type index {0}", type)
log.debug(u"ignoring unknown image type index %s", type)
type = ImageType.other
self.type = type