Skip to content

Commit

Permalink
use ctx in log
Browse files Browse the repository at this point in the history
  • Loading branch information
ktong committed Feb 3, 2024
1 parent debdd69 commit 93af706
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion provider/file/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (f File) Watch(ctx context.Context, onChange func(map[string]any)) error {

switch {
case event.Has(fsnotify.Remove):
f.logger.Warn("Config file has been removed.", "file", f.path)
f.logger.WarnContext(ctx, "Config file has been removed.", "file", f.path)
onChange(nil)
case event.Has(fsnotify.Create) || event.Has(fsnotify.Write):
values, err := f.Load()
Expand Down
2 changes: 1 addition & 1 deletion watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (c *Config) Watch(ctx context.Context) error { //nolint:cyclop,funlen,gocog
watched = false
})
if watched {
c.logger.Warn("Config has been watched, call Watch again has no effects.")
c.logger.WarnContext(ctx, "Config has been watched, call Watch again has no effects.")

return nil
}
Expand Down

0 comments on commit 93af706

Please sign in to comment.