Skip to content

Commit

Permalink
logging fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cccaaannn committed Feb 12, 2023
1 parent 4789608 commit 7f5e719
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ def wrapper(*args, **kwargs):
logger.info(f"User: {args[0].message.from_user} | Function: {function_name} | Args: {args[1].args}")
func(*args, **kwargs)
except(AuthorizationError) as ae:
logger.warning(f"User: {args[0].message.from_user} | Function: {function_name} | Args: {args[1].args}")
logger.warning(f"User (not authorized): {args[0].message.from_user} | Function: {function_name} | Args: {args[1].args}")
args[0].message.reply_text(str(ae))
except(IndexError, ValueError):
logger.warning(f"User: {args[0].message.from_user} | Function: {function_name} | Args: {args[1].args}")
logger.warning(f"User (incorrect function usage): {args[0].message.from_user} | Function: {function_name} | Args: {args[1].args}")
if(function_usage == ""):
args[0].message.reply_text("Functions did not used properly")
else:
args[0].message.reply_text(f"Usage {function_usage}")
func(*args, **kwargs)
except:
logger.error(f"User:{args[0].message.from_user} | Function: {function_name} | Args: {args[1].args}", exc_info=True)
logger.error(f"User: {args[0].message.from_user} | Function: {function_name} | Args: {args[1].args}", exc_info=True)
args[0].message.reply_text("Something went wrong")
return wrapper
return decorator
Expand Down

0 comments on commit 7f5e719

Please sign in to comment.