From 7f43131eaa611e59836d1b146200065e96cd0392 Mon Sep 17 00:00:00 2001 From: Stefano Arlandini Date: Mon, 21 Mar 2022 10:35:06 +0100 Subject: [PATCH] Improve log messages in case of error while generating the file hash --- key/generator/metadata.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/key/generator/metadata.go b/key/generator/metadata.go index 9c129988..e665b339 100644 --- a/key/generator/metadata.go +++ b/key/generator/metadata.go @@ -132,13 +132,13 @@ func hashFilesFunc(logger log.Logger) func(...string) string { func fileHash(path string, logger log.Logger) []byte { path, err := filepath.Abs(filepath.Clean(path)) if err != nil { - level.Error(logger).Log("cache key template/checksum could not find file") + level.Error(logger).Log("could not compute the absolute file path: %s", err.Error()) return []byte{} } f, err := os.Open(path) if err != nil { - level.Error(logger).Log("cache key template/checksum could not open file") + level.Error(logger).Log("could not open the file: %s", err.Error()) return []byte{} } @@ -146,7 +146,7 @@ func fileHash(path string, logger log.Logger) []byte { h, err := readerHasher(f) if err != nil { - level.Error(logger).Log("cache key template/checksum could not generate hash") + level.Error(logger).Log("could not generate the hash of the input file: %s", err.Error()) return []byte{} }