Skip to content

Commit

Permalink
reduce info log
Browse files Browse the repository at this point in the history
  • Loading branch information
ktong committed Feb 2, 2024
1 parent 9d4db8d commit 1112147
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,11 @@ func (c *Config) Watch(ctx context.Context) error { //nolint:cyclop,funlen,gocog
maps.Merge(values, w.values)
}
c.values = values
slog.Info("Configuration has been updated with change.")
slog.DebugContext(ctx, "Configuration has been updated with change.")

if len(onChanges) > 0 {
func() {
ctx, cancel = context.WithTimeout(context.Background(), time.Minute)
ctx, cancel = context.WithTimeout(ctx, time.Minute)
defer cancel()

done := make(chan struct{})
Expand All @@ -151,7 +151,7 @@ func (c *Config) Watch(ctx context.Context) error { //nolint:cyclop,funlen,gocog

select {
case <-done:
slog.InfoContext(ctx, "Configuration has been applied to onChanges.")
slog.DebugContext(ctx, "Configuration has been applied to onChanges.")
case <-ctx.Done():
if errors.Is(ctx.Err(), context.DeadlineExceeded) {
slog.WarnContext(ctx, "Configuration has not been fully applied to onChanges due to timeout."+
Expand Down Expand Up @@ -207,7 +207,7 @@ func (c *Config) Watch(ctx context.Context) error { //nolint:cyclop,funlen,gocog
)
}

slog.Info("Watching configuration change.", "loader", watcher)
slog.DebugContext(ctx, "Watching configuration change.", "loader", watcher)
if err := watcher.Watch(ctx, onChange); err != nil {
errChan <- fmt.Errorf("watch configuration change: %w", err)
cancel()
Expand Down

0 comments on commit 1112147

Please sign in to comment.