From 6ab3537649e3553cf8c620aea2053cd0738dd055 Mon Sep 17 00:00:00 2001
From: plexpt <plexpt@gmail.com>
Date: Tue, 2 Jan 2024 21:25:55 +0800
Subject: [PATCH] add error logging

---
 fooocusapi/worker.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fooocusapi/worker.py b/fooocusapi/worker.py
index 9a4f47f..438b4b8 100644
--- a/fooocusapi/worker.py
+++ b/fooocusapi/worker.py
@@ -4,6 +4,8 @@
 import numpy as np
 import torch
 import re
+import logging
+
 from typing import List
 from fooocusapi.file_utils import save_output_file
 from fooocusapi.parameters import GenerationFinishReason, ImageGenerationParams, ImageGenerationResult
@@ -830,6 +832,8 @@ def callback(step, x0, x, total_steps, y):
         return yield_result(None, results, tasks)
     except Exception as e:
         print('Worker error:', e)
+        logging.exception(e)
+
         if not async_task.is_finished:
             task_queue.finish_task(async_task.job_id)
             async_task.set_result([], True, str(e))