Skip to content

Commit 19af705

Browse files
committed
Further cleanup of logging statements.
1 parent 32e8f29 commit 19af705

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

celery_haystack/tasks.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ def run(self, action, identifier, **kwargs):
117117
# Then get the model class for the object path
118118
model_class = self.get_model_class(object_path, **kwargs)
119119
current_index = self.get_index(model_class, **kwargs)
120+
current_index_name = ".".join([current_index.__class__.__module__,
121+
current_index.__class__.__name__])
120122

121123
if action == 'delete':
122124
# If the object is gone, we'll use just the identifier
@@ -128,17 +130,17 @@ def run(self, action, identifier, **kwargs):
128130
logger.error(exc)
129131
self.retry(exc=exc)
130132
else:
131-
msg = ("Deleted '%s' from index %s" %
132-
(identifier, current_index))
133+
msg = ("Deleted '%s' (with %s)" %
134+
(identifier, current_index_name))
133135
logger.debug(msg)
134136
return msg
135137

136138
elif action == 'update':
137139
# and the instance of the model class with the pk
138140
instance = self.get_instance(model_class, pk, **kwargs)
139141
if instance is None:
140-
logger.debug("Didn't update index %s for '%s'" %
141-
(current_index, identifier))
142+
logger.debug("Failed updating '%s' (with %s)" %
143+
(identifier, current_index_name))
142144
raise ValueError("Couldn't load object '%s'" % identifier)
143145

144146
# Call the appropriate handler of the current index and
@@ -150,8 +152,8 @@ def run(self, action, identifier, **kwargs):
150152
logger.error(exc)
151153
self.retry(exc=exc)
152154
else:
153-
msg = ("Updated index %s with '%s'" %
154-
(current_index, instance))
155+
msg = ("Updated '%s' (with %s)" %
156+
(identifier, current_index_name))
155157
logger.debug(msg)
156158
return msg
157159
else:

0 commit comments

Comments
 (0)