From 2b2ad502e56c75d126550acf9cd3d74bcffd64bb Mon Sep 17 00:00:00 2001 From: mpl Date: Thu, 22 Oct 2015 17:37:21 +0200 Subject: [PATCH] pkg/index/receive: unless CAMLI_DEBUG_IMAGES, be less EXIF-verbose Change-Id: Iec0c9acae268285980ce04943c58d56ae19fb711 --- pkg/index/receive.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pkg/index/receive.go b/pkg/index/receive.go index e07b17a92..4b9bbadff 100644 --- a/pkg/index/receive.go +++ b/pkg/index/receive.go @@ -27,6 +27,7 @@ import ( "log" "os" "sort" + "strconv" "strings" "sync" "time" @@ -384,6 +385,8 @@ func readPrefixOrFile(prefix []byte, fetcher blob.Fetcher, b *schema.Blob, fn fu return err } +var exifDebug, _ = strconv.ParseBool(os.Getenv("CAMLI_DEBUG_IMAGES")) + // b: the parsed file schema blob // mm: keys to populate func (ix *Index) populateFile(fetcher blob.Fetcher, b *schema.Blob, mm *mutationMap) (err error) { @@ -429,14 +432,18 @@ func (ix *Index) populateFile(fetcher blob.Fetcher, b *schema.Blob, mm *mutation if err = readPrefixOrFile(imageBuf.Bytes, fetcher, b, fileTime); err == nil { times = append(times, ft) } - log.Printf("filename %q exif = %v, %v", b.FileName(), ft, err) + if exifDebug { + log.Printf("filename %q exif = %v, %v", b.FileName(), ft, err) + } // TODO(mpl): find (generate?) more broken EXIF images to experiment with. indexEXIFData := func(r filePrefixReader) error { return indexEXIF(wholeRef, r, mm) } if err = readPrefixOrFile(imageBuf.Bytes, fetcher, b, indexEXIFData); err != nil { - log.Printf("error parsing EXIF: %v", err) + if exifDebug { + log.Printf("error parsing EXIF: %v", err) + } } }