refactor(logging): log with the caller's context so records carry trace ids

This commit is contained in:
sam committed 2026-10-25 23:30:01 +11:00
1 parent 0611e00330
commit 656feab2a4
118 files changed
+512 -511

No files matched your search

+3 -3
View File
@@ -27,13 +27,13 @@ func MarkSafe(ctx context.Context, mountDir string, log *slog.Logger) bool {
func markSafe(ctx context.Context, mountDir string, run gitRunner, log *slog.Logger) bool {
info, err := os.Stat(mountDir)
if err != nil || !info.IsDir() {
log.Debug("git safe.directory skipped: mountDir does not exist", "dir", mountDir)
log.DebugContext(ctx, "git safe.directory skipped: mountDir does not exist", "dir", mountDir)
return false
}
out, err := run(ctx, "config", "--global", "--add", "safe.directory", mountDir)
if err != nil {
log.Warn(
log.WarnContext(ctx,
"git safe.directory config failed -- gates that shell out to git may fail",
"dir", mountDir,
"err", err,
@@ -42,6 +42,6 @@ func markSafe(ctx context.Context, mountDir string, run gitRunner, log *slog.Log
return false
}
log.Info("git safe.directory configured", "dir", mountDir)
log.InfoContext(ctx, "git safe.directory configured", "dir", mountDir)
return true
}