Skip to content

Commit

Permalink
feat: logging from get_board_creds
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeyqu committed Mar 30, 2024
1 parent f1bad9a commit 40a5ec2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/tg/handlers/get_board_credentials_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from ...db.db_client import DBClient
from ...strings import load
from .utils import get_sender_username, reply
from .utils import get_sender_id, get_sender_username, reply


logger = logging.getLogger(__name__)
Expand All @@ -16,6 +16,7 @@ def get_board_credentials(update: telegram.Update, tg_context):
if member.telegram == f"@{get_sender_username(update)}"
), None)
if member is None or not member.trello:
logger.warn(f'Trello username not found for {get_sender_username(update)}, ID={get_sender_id(update)}')
reply(load('get_board_credentials_handler__not_found'), update)
return
try:
Expand All @@ -27,8 +28,10 @@ def get_board_credentials(update: telegram.Update, tg_context):
cred for cred in board_json if cred["trelloUsername"] == member.trello
), None)
if not creds:
logger.warn(f'Board creds not found for user {get_sender_username(update)}')
reply(load('get_board_credentials_handler__not_found'), update)
return
logger.info(f'Board creds found for username {get_sender_username(update)}')
reply(
load(
'get_board_credentials_handler__found',
Expand Down

0 comments on commit 40a5ec2

Please sign in to comment.