From 93af706d4967e93e086534784710e6700dcaad5c Mon Sep 17 00:00:00 2001 From: ktong Date: Sat, 3 Feb 2024 12:23:39 -0800 Subject: [PATCH] use ctx in log --- provider/file/watch.go | 2 +- watch.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/provider/file/watch.go b/provider/file/watch.go index 3be02a00..437c67c7 100644 --- a/provider/file/watch.go +++ b/provider/file/watch.go @@ -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() diff --git a/watch.go b/watch.go index 44ed96da..eac0fc76 100644 --- a/watch.go +++ b/watch.go @@ -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 }