extended logging
This commit is contained in:
@@ -209,16 +209,29 @@ func (m *confirmationManager) HandleUpdate(ctx context.Context, update *telegram
|
||||
return
|
||||
}
|
||||
if update == nil {
|
||||
m.logDebug("Telegram update ignored: update is nil")
|
||||
m.logInfo("Telegram update ignored: update is nil")
|
||||
return
|
||||
}
|
||||
if update.Message == nil {
|
||||
m.logDebug("Telegram update ignored: message is nil")
|
||||
m.logInfo("Telegram update ignored: message is nil", zap.Int64("update_id", update.UpdateID))
|
||||
return
|
||||
}
|
||||
message := update.Message
|
||||
fields := []zap.Field{
|
||||
zap.Int64("update_id", update.UpdateID),
|
||||
zap.Int64("message_id", message.MessageID),
|
||||
zap.Int64("chat_id", message.Chat.ID),
|
||||
zap.Int("text_length", len(message.Text)),
|
||||
}
|
||||
if message.From != nil {
|
||||
fields = append(fields, zap.Int64("from_user_id", message.From.ID))
|
||||
}
|
||||
if message.ReplyToMessage != nil {
|
||||
fields = append(fields, zap.Int64("reply_to_message_id", message.ReplyToMessage.MessageID))
|
||||
}
|
||||
m.logInfo("Handling Telegram confirmation update", fields...)
|
||||
if message.ReplyToMessage == nil {
|
||||
m.logDebug("Telegram update ignored: message is not a reply", zap.Int64("message_id", message.MessageID))
|
||||
m.logInfo("Telegram update ignored: message is not a reply", zap.Int64("message_id", message.MessageID))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -226,7 +239,7 @@ func (m *confirmationManager) HandleUpdate(ctx context.Context, update *telegram
|
||||
m.logDebug("Telegram reply received", zap.String("reply_to_message_id", replyToID))
|
||||
state := m.lookupByMessageID(replyToID)
|
||||
if state == nil {
|
||||
m.logDebug("Telegram reply ignored: no pending confirmation for message", zap.String("reply_to_message_id", replyToID))
|
||||
m.logInfo("Telegram reply ignored: no pending confirmation for message", zap.String("reply_to_message_id", replyToID), zap.Int64("update_id", update.UpdateID))
|
||||
return
|
||||
}
|
||||
m.logDebug("Telegram reply matched pending confirmation",
|
||||
@@ -235,7 +248,7 @@ func (m *confirmationManager) HandleUpdate(ctx context.Context, update *telegram
|
||||
|
||||
chatID := strconv.FormatInt(message.Chat.ID, 10)
|
||||
if chatID != state.targetChatID {
|
||||
m.logDebug("Telegram reply ignored: chat mismatch",
|
||||
m.logInfo("Telegram reply ignored: chat mismatch",
|
||||
zap.String("request_id", state.request.RequestID),
|
||||
zap.String("expected_chat_id", state.targetChatID),
|
||||
zap.String("chat_id", chatID))
|
||||
|
||||
Reference in New Issue
Block a user