refactor: Standardized logging to be more uniform

This commit is contained in:
Noah 2025-08-31 03:51:36 +02:00
parent 99a81a201b
commit 38db97bdcf
No known key found for this signature in database
GPG key ID: D2A7E2C8F77E0430
8 changed files with 28 additions and 28 deletions

View file

@ -9,7 +9,7 @@ import (
func Authenticate() (tgbotapi.UpdatesChannel, *tgbotapi.BotAPI) {
bot, err := tgbotapi.NewBotAPI(config.BotConfig.TelegramAPIToken)
if err != nil {
log.Panic().Err(err).Msg("Failed to authenticate")
log.Panic().Err(err).Msg("Failed to authenticate to Telegram")
}
bot.Debug = false
@ -20,7 +20,7 @@ func Authenticate() (tgbotapi.UpdatesChannel, *tgbotapi.BotAPI) {
updates := tgbotapi.NewUpdate(0)
updates.Timeout = 60
log.Info().Int64("ID", bot.Self.ID).Str("username", bot.Self.UserName).Msg("Authenticated to Telegram API")
log.Info().Int64("ID", bot.Self.ID).Str("username", bot.Self.UserName).Msg("Authenticated to Telegram successfully")
return bot.GetUpdatesChan(updates), bot

View file

@ -12,7 +12,7 @@ func SendMessage(message tgbotapi.MessageConfig, bot *tgbotapi.BotAPI) (result t
return
}
log.Info().Int64("chat", result.Chat.ID).Str("msg", result.Text).Msg("Sent message")
log.Info().Int64("chat", result.Chat.ID).Str("msg", result.Text).Msg("Sent message successfully")
log.Debug().Interface("msg", result).Msg("")
return result
@ -25,7 +25,7 @@ func EditMessage(message tgbotapi.EditMessageTextConfig, bot *tgbotapi.BotAPI) (
return
}
log.Info().Int64("chat", result.Chat.ID).Str("msg", result.Text).Msg("Edited message")
log.Info().Int64("chat", result.Chat.ID).Str("msg", result.Text).Msg("Edited message successfully")
log.Debug().Interface("msg", result).Msg("")
return result
@ -38,7 +38,7 @@ func SendVideo(message tgbotapi.VideoConfig, bot *tgbotapi.BotAPI) (result tgbot
return
}
log.Info().Int64("chat", result.Chat.ID).Msg("Sent video")
log.Info().Int64("chat", result.Chat.ID).Msg("Sent video successfully")
log.Debug().Interface("video", result).Msg("")
return result
@ -51,7 +51,7 @@ func SendPhoto(message tgbotapi.PhotoConfig, bot *tgbotapi.BotAPI) (result tgbot
return
}
log.Info().Int64("chat", result.Chat.ID).Msg("Sent photo")
log.Info().Int64("chat", result.Chat.ID).Msg("Sent photo successfully")
log.Debug().Interface("photo", result).Msg("")
return result
@ -64,7 +64,7 @@ func SendSticker(message tgbotapi.StickerConfig, bot *tgbotapi.BotAPI) (result t
return
}
log.Info().Int64("chat", result.Chat.ID).Msg("Sent sticker")
log.Info().Int64("chat", result.Chat.ID).Msg("Sent sticker successfully")
log.Debug().Interface("sticker", result).Msg("")
return result