mirror of
https://github.com/Hopiu/django-imagekit.git
synced 2026-03-17 05:40:25 +00:00
Use named logger
This commit is contained in:
parent
a265fd79e1
commit
ca1db05c4e
2 changed files with 10 additions and 4 deletions
|
|
@ -2,11 +2,10 @@ from django.conf import settings
|
|||
from django.core.files.base import ContentFile, File
|
||||
from django.core.files.images import ImageFile
|
||||
from django.utils.encoding import smart_str, smart_unicode
|
||||
import logging
|
||||
import os
|
||||
from .signals import before_access
|
||||
from .utils import (suggest_extension, format_to_mimetype,
|
||||
extension_to_mimetype)
|
||||
extension_to_mimetype, get_logger)
|
||||
|
||||
|
||||
class BaseIKFile(File):
|
||||
|
|
@ -115,8 +114,7 @@ class ImageSpecCacheFile(BaseIKFile, ImageFile):
|
|||
actual_name = self.storage.save(self.name, content)
|
||||
|
||||
if actual_name != self.name:
|
||||
# TODO: Use named logger?
|
||||
logging.warning('The storage backend %s did not save the file'
|
||||
get_logger().warning('The storage backend %s did not save the file'
|
||||
' with the requested name ("%s") and instead used'
|
||||
' "%s". This may be because a file already existed with'
|
||||
' the requested name. If so, you may have meant to call'
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import logging
|
||||
import os
|
||||
import mimetypes
|
||||
import sys
|
||||
|
|
@ -398,3 +399,10 @@ def autodiscover():
|
|||
# attempting to import it, otherwise we want it to bubble up.
|
||||
if module_has_submodule(mod, 'imagespecs'):
|
||||
raise
|
||||
|
||||
|
||||
def get_logger(logger_name='imagekit', add_null_handler=True):
|
||||
logger = logging.getLogger(logger_name)
|
||||
if add_null_handler:
|
||||
logger.addHandler(logging.NullHandler())
|
||||
return logger
|
||||
|
|
|
|||
Loading…
Reference in a new issue