Skip to content

Commit

Permalink
refactor: move system task results to debug logger in middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
fubuloubu committed May 10, 2024
1 parent 55185fc commit c4633b2
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions silverback/middlewares.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,12 @@ def post_execute(self, message: TaskiqMessage, result: TaskiqResult):
else:
percent_display = ""

(logger.error if result.error else logger.success)(
f"{self._create_label(message)} " f"- {result.execution_time:.3f}s{percent_display}"
)
msg = f"{self._create_label(message)} " f"- {result.execution_time:.3f}s{percent_display}"
if result.is_err:
logger.error(msg)
elif message.task_name.startswith("system:"):
logger.debug(msg)
else:
logger.success(msg)

# NOTE: Unless stdout is ignored, error traceback appears in stdout, no need for `on_error`

0 comments on commit c4633b2

Please sign in to comment.