Skip to content

Commit

Permalink
Log details of the cache's parent directory
Browse files Browse the repository at this point in the history
  • Loading branch information
myleshorton committed Oct 24, 2024
1 parent a348358 commit 849c965
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package fronted
import (
"encoding/json"
"os"
"path/filepath"
"time"
)

Expand Down Expand Up @@ -87,6 +88,16 @@ func (d *direct) updateCache(cacheFile string) {
err = os.WriteFile(cacheFile, b, 0644)
if err != nil {
log.Errorf("Unable to save cache to disk: %v", err)
// Log the directory of the cache file and if it exists for debugging purposes
parent := filepath.Dir(cacheFile)
// check if the parent directory exists
if _, err := os.Stat(parent); err == nil {
// parent directory exists
log.Debugf("Parent directory of cache file exists: %v", parent)
} else {
// parent directory does not exist
log.Debugf("Parent directory of cache file does not exist: %v", parent)
}
}
}

Expand Down

0 comments on commit 849c965

Please sign in to comment.