Skip to content

Commit

Permalink
add some logging
Browse files Browse the repository at this point in the history
  • Loading branch information
fbuetler committed Mar 29, 2024
1 parent 37f62da commit b9cd1dc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/controller/DiscordController.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ func (dc *DiscordController) GetDiscordUserCard(searchString string, buttonsEnab
convertData(session.BytesReceived),
convertData(session.BytesSent),
}
log.Debugf("Start: '%s' End: '%s' End reason: '%s' Switch name (+loc): '%s' Switch port: '%s' Assigned IP: '%s' Received: '%s' Send: '%s' ",
row[0], row[1], row[2], row[3], row[4], row[5], row[6], row[7])

table.Append(row)
}
Expand All @@ -215,6 +217,7 @@ func (dc *DiscordController) GetDiscordUserCard(searchString string, buttonsEnab
} else {
card.Content = "No session found for this user, check back once they're plugged in."
}
log.Debugf("user card content: '%s'", card.Content)

if !shortCard {
// Available VLANs
Expand All @@ -230,8 +233,10 @@ func (dc *DiscordController) GetDiscordUserCard(searchString string, buttonsEnab
log.WithField("ip", switchIP.String()).Warn("Unknown switch returned from RADIUS query!")
}
if err != nil || switchRef == nil {
log.Debug("vlan is missing")
vlansMissing = true
} else {
log.Debug("crafting vlan menu")
var vlanMenu []discordgo.SelectMenuOption
for _, vlan := range switchRef.Vlans {
isDefault := switchRef.PrimaryVlan == vlan
Expand Down
4 changes: 4 additions & 0 deletions pkg/discord/Commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,10 @@ func (d *Discord) handleUserSubcommand(s *discordgo.Session, i *discordgo.Intera
}
d.macCache[i.Interaction.ID] = userCard.RealMAC

log.Debugf("user card content: '%s'", userCard.Content)
log.Debugf("user card components: '%v'", userCard.Components)
log.Debugf("user card embeds: '%v'", userCard.Embeds)

err = s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
Type: discordgo.InteractionResponseChannelMessageWithSource,
Data: &discordgo.InteractionResponseData{
Expand Down

0 comments on commit b9cd1dc

Please sign in to comment.