Skip to content

Commit

Permalink
Merge pull request #15 from Flagsmith/feat/log-errors
Browse files Browse the repository at this point in the history
feat: Log task run errors at ERROR level
  • Loading branch information
khvn26 authored Dec 4, 2024
2 parents c43af41 + d471442 commit 60a1c3e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion task_processor/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def _run_task(task: typing.Union[Task, RecurringTask]) -> typing.Tuple[Task, Tas
task_run.finished_at = timezone.now()
task.mark_success()
except Exception as e:
logger.warning(
logger.error(
"Failed to execute task '%s'. Exception was: %s",
task.task_identifier,
str(e),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,9 @@ def test_run_task_runs_task_and_creates_task_run_object_when_failure(

assert len(caplog.records) == 3

warning_log = caplog.records[0]
assert warning_log.levelname == "WARNING"
assert warning_log.message == (
log_record = caplog.records[0]
assert log_record.levelname == "ERROR"
assert log_record.message == (
f"Failed to execute task '{task.task_identifier}'. Exception was: {msg}"
)

Expand Down

0 comments on commit 60a1c3e

Please sign in to comment.