Log the index of the configuration which failed to initialize

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2021-07-25 13:42:38 +02:00
parent d877ce02d4
commit 00e4b2f859
Signed by: luzifer
GPG key ID: 0066F03ED215AD7D

View file

@ -64,8 +64,11 @@ func main() {
discord.Identify.Intents = discordgo.IntentsAll
var enabledModules int
for _, mc := range config.ModuleConfigs {
logger := log.WithField("module", mc.Type)
for i, mc := range config.ModuleConfigs {
logger := log.WithFields(log.Fields{
"idx": i,
"module": mc.Type,
})
mod := GetModuleByName(mc.Type)
if mod == nil {
logger.Fatal("Found configuration for unsupported module")