VTGare / boe-tea-go

Source image bot for Discord
MIT License
20 stars 7 forks source link

Use standard logging format #24

Closed VTGare closed 1 year ago

VTGare commented 2 years ago

To put it bluntly, logging is a bit of a mess right now. Standardize logging everywhere and

Example:

func OnMessageRemove(b *bot.Bot) func(*discordgo.Session, *discordgo.MessageDelete) {
    return func(s *discordgo.Session, m *discordgo.MessageDelete) {
        msg, ok := b.EmbedCache.Get(m.ChannelID, m.ID)
                if !ok {
                    return
                }

        log := b.Log.With(
            "guild_id": m.GuildID,
                    "channel_id": m.ChannelID,
                    "message_id": m.ID,
                    "author_id": msg.AuthorID,
                )

                log.Debug("artwork message was removed, deleting embeds")

               // Bunch of other code
       }
}

It's okay to add more logs in scope of this issue, but it's not required.

Mihai22125 commented 2 years ago

Hi @VTGare, can I work on this?

VTGare commented 2 years ago

Hi @VTGare, can I work on this?

Sure, any contributions are welcome. @Mihai22125

VTGare commented 2 years ago

I updated the first message to give you an example of how I imagined it to look like. https://github.com/VTGare/boe-tea-go/tree/master/handlers is a good place to start.

VTGare commented 1 year ago

Partially covered in 50b838bd0bcc07f59436fcbb4364276900b23f15

Mihai22125 commented 1 year ago

Hello @VTGare, sorry for the delay. I would still like to contribute on this, so I've started with the handlers package and I raised a new PR for that. Could you review my changes before I move to the remaining packages? Any feedback is more than welcome!