Skip to content

Commit

Permalink
chore(timers): replace debug with info
Browse files Browse the repository at this point in the history
  • Loading branch information
Satont committed Aug 17, 2023
1 parent 7c66df1 commit cc6a80e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
13 changes: 9 additions & 4 deletions apps/timers/internal/queue/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,21 @@ func (c *Queue) handle(t *timer) {
}

if !channel.Enabled {
c.logger.Debug("channel not enabled", slog.String("channelId", t.ChannelID))
c.logger.Info("channel not enabled", slog.String("channelId", t.ChannelID))
return
}

if !channel.IsBotMod {
c.logger.Info("bot is not moderator, response wont be sent", slog.String("channelId", t.ChannelID))
return
}

stream, err := c.streamsRepository.GetByChannelId(t.ChannelID)
if err != nil && errors.Is(err, streams.NotFound) && c.config.AppEnv != "development" {
c.logger.Debug("stream not found, probably channel is offline", slog.String("channelId", t.ChannelID))
c.logger.Info("stream not found, probably channel is offline", slog.String("channelId", t.ChannelID))
return
} else if err != nil && c.config.AppEnv != "development" {
c.logger.Error("error on getting stream", slog.String("channelId", t.ChannelID), slog.Any("error", err))
c.logger.Info("error on getting stream", slog.String("channelId", t.ChannelID), slog.Any("error", err))
return
}

Expand All @@ -41,7 +46,7 @@ func (c *Queue) handle(t *timer) {

// not found
if response.ID == "" || response.Text == "" {
c.logger.Debug(
c.logger.Info(
"timer text or id is empty",
slog.String("responseId", response.ID),
slog.String("timerId", t.ID),
Expand Down
1 change: 1 addition & 0 deletions apps/timers/internal/repositories/channels/gorm.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ func (c *gormRepository) GetById(id string) (Channel, error) {

result.ID = channel.ID
result.Enabled = channel.IsEnabled
result.IsBotMod = channel.IsBotMod

return result, nil
}
5 changes: 3 additions & 2 deletions apps/timers/internal/repositories/channels/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ type Repository interface {
}

type Channel struct {
ID string
Enabled bool
ID string
Enabled bool
IsBotMod bool
}

0 comments on commit cc6a80e

Please sign in to comment.