Skip to content

Commit

Permalink
Improve logger
Browse files Browse the repository at this point in the history
  • Loading branch information
idrissneumann committed Dec 14, 2024
1 parent 18770ee commit de74fee
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.0.15
4.0.16
8 changes: 5 additions & 3 deletions src/utils/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,15 @@ def quiet_log_msg (log_level, message):
else:
logging.info(formatted_log)

return formatted_log

def is_notif_enabled():
notifs_providers = ['SLACK', 'DISCORD']
return any(is_true(os.getenv("{}_TRIGGER".format(n))) for n in notifs_providers)

def log_msg(log_level, message, is_public = False):
quiet_log_msg (log_level, message)
formatted_log = quiet_log_msg (log_level, message)

if get_int_value_level(log_level) >= get_int_value_level(LOG_LEVEL) and is_notif_enabled():
slack_message(log_level, message, is_public)
discord_message(log_level, message, is_public)
slack_message(log_level, formatted_log, is_public)
discord_message(log_level, formatted_log, is_public)

0 comments on commit de74fee

Please sign in to comment.