From 00fb3c8c9601a6be88e21a355ab7ad67b275dae4 Mon Sep 17 00:00:00 2001 From: John Ky Date: Thu, 22 Dec 2022 00:28:24 +1100 Subject: [PATCH] Better logging --- .../CabalCache/Concurrent/DownloadQueue.hs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/HaskellWorks/CabalCache/Concurrent/DownloadQueue.hs b/src/HaskellWorks/CabalCache/Concurrent/DownloadQueue.hs index 6fd21ee7..2900a0f7 100644 --- a/src/HaskellWorks/CabalCache/Concurrent/DownloadQueue.hs +++ b/src/HaskellWorks/CabalCache/Concurrent/DownloadQueue.hs @@ -72,12 +72,16 @@ runQueue downloadQueue f = do Just packageId -> do downloadStatus <- f packageId & do CMC.handleAll \e -> do - liftIO $ CIO.hPutStrLn IO.stderr $ "Warning: Unexpected exception during download: " <> tshow e + liftIO $ CIO.hPutStrLn IO.stderr $ "Warning: Unexpected exception during download of " <> packageId <> ": " <> tshow e liftIO $ IO.hFlush IO.stderr pure DownloadFailure case downloadStatus of - DownloadSuccess -> do liftIO $ STM.atomically $ commit downloadQueue packageId - DownloadFailure -> do liftIO $ STM.atomically $ failDownload downloadQueue packageId + DownloadSuccess -> do + liftIO $ CIO.hPutStrLn IO.stderr $ "Downloaded " <> packageId + liftIO $ STM.atomically $ commit downloadQueue packageId + DownloadFailure -> do + liftIO $ CIO.hPutStrLn IO.stderr $ "Failed to download " <> packageId + liftIO $ STM.atomically $ failDownload downloadQueue packageId runQueue downloadQueue f Nothing -> return ()