
    t2h                         S SK r SSKJr  S rg)    N   )ErrorLogc           	      Z    [        U[        5      (       a$  [        U5       S[        R                  " 5        3nO[        U5      n[
        R                  R                  U US9  g! [         a;  n[        S[        U5       35        [        SU  S[        U5       35         SnAgSnAff = f)z
Log an error to the database

Args:
    task_source (str): The source of the error (method, controller, view name)
    error (Exception or str): The error object or error message

)task_sourceerrorzFailed to log error: zOriginal error from z: N)	
isinstance	Exceptionstr	traceback
format_excr   objectscreateprint)r   r   error_messagees        D:\TimeStamps\ErrorLogs\utils.py	log_errorr      s    BeY''"5zl"Y-A-A-C,DEMJM 	# 	  	
  B%c!fX./$[MCJ<@AABs   A"A% %
B*/1B%%B*)r   modelsr   r        r   <module>r      s     Br   