Add detailed logging for image requests with cache status and timing
This commit is contained in:
@@ -90,6 +90,8 @@ type ImageResponse struct {
|
||||
LastModified time.Time
|
||||
// CacheStatus indicates HIT, MISS, or STALE
|
||||
CacheStatus CacheStatus
|
||||
// FetchedBytes is the number of bytes fetched from upstream (0 if cache hit)
|
||||
FetchedBytes int64
|
||||
}
|
||||
|
||||
// CacheStatus indicates whether the response was served from cache.
|
||||
|
||||
@@ -172,6 +172,7 @@ func (s *Service) fetchAndProcess(ctx context.Context, req *ImageRequest) (*Imag
|
||||
Content: io.NopCloser(bytes.NewReader(processedData)),
|
||||
ContentLength: int64(len(processedData)),
|
||||
ContentType: processResult.ContentType,
|
||||
FetchedBytes: int64(len(sourceData)),
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user