File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 11import functools
22import time
3+ import traceback
34
45from memos .log import get_logger
56
@@ -35,6 +36,7 @@ def decorator(fn):
3536 def wrapper (* args , ** kwargs ):
3637 start = time .perf_counter ()
3738 exc_type = None
39+ exc_message = None
3840 result = None
3941 success_flag = False
4042
@@ -44,6 +46,7 @@ def wrapper(*args, **kwargs):
4446 return result
4547 except Exception as e :
4648 exc_type = type (e )
49+ exc_message = traceback .format_exc ()
4750 success_flag = False
4851
4952 if fallback is not None and callable (fallback ):
@@ -76,13 +79,15 @@ def wrapper(*args, **kwargs):
7679
7780 status = "SUCCESS" if success_flag else "FAILED"
7881 status_info = f", status: { status } "
79-
8082 if not success_flag and exc_type is not None :
81- status_info += f", error: { exc_type .__name__ } "
83+ status_info += (
84+ f", error_type: { exc_type .__name__ } , error_message: { exc_message } "
85+ )
8286
8387 msg = (
8488 f"[TIMER_WITH_STATUS] { log_prefix or fn .__name__ } "
8589 f"took { elapsed_ms :.0f} ms{ status_info } , args: { ctx_str } "
90+ f", result: { result } "
8691 )
8792
8893 logger .info (msg )
You can’t perform that action at this time.
0 commit comments