mirror of
https://github.com/Hopiu/django-imagekit.git
synced 2026-05-23 19:55:50 +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.base import ContentFile, File
|
||||||
from django.core.files.images import ImageFile
|
from django.core.files.images import ImageFile
|
||||||
from django.utils.encoding import smart_str, smart_unicode
|
from django.utils.encoding import smart_str, smart_unicode
|
||||||
import logging
|
|
||||||
import os
|
import os
|
||||||
from .signals import before_access
|
from .signals import before_access
|
||||||
from .utils import (suggest_extension, format_to_mimetype,
|
from .utils import (suggest_extension, format_to_mimetype,
|
||||||
extension_to_mimetype)
|
extension_to_mimetype, get_logger)
|
||||||
|
|
||||||
|
|
||||||
class BaseIKFile(File):
|
class BaseIKFile(File):
|
||||||
|
|
@ -115,8 +114,7 @@ class ImageSpecCacheFile(BaseIKFile, ImageFile):
|
||||||
actual_name = self.storage.save(self.name, content)
|
actual_name = self.storage.save(self.name, content)
|
||||||
|
|
||||||
if actual_name != self.name:
|
if actual_name != self.name:
|
||||||
# TODO: Use named logger?
|
get_logger().warning('The storage backend %s did not save the file'
|
||||||
logging.warning('The storage backend %s did not save the file'
|
|
||||||
' with the requested name ("%s") and instead used'
|
' with the requested name ("%s") and instead used'
|
||||||
' "%s". This may be because a file already existed with'
|
' "%s". This may be because a file already existed with'
|
||||||
' the requested name. If so, you may have meant to call'
|
' the requested name. If so, you may have meant to call'
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import logging
|
||||||
import os
|
import os
|
||||||
import mimetypes
|
import mimetypes
|
||||||
import sys
|
import sys
|
||||||
|
|
@ -398,3 +399,10 @@ def autodiscover():
|
||||||
# attempting to import it, otherwise we want it to bubble up.
|
# attempting to import it, otherwise we want it to bubble up.
|
||||||
if module_has_submodule(mod, 'imagespecs'):
|
if module_has_submodule(mod, 'imagespecs'):
|
||||||
raise
|
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