diff options
-rw-r--r-- | src/Hakyll/Core/Compiler.hs | 2 | ||||
-rw-r--r-- | src/Hakyll/Core/Logger.hs | 9 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/Hakyll/Core/Compiler.hs b/src/Hakyll/Core/Compiler.hs index d6090e9..e4922dd 100644 --- a/src/Hakyll/Core/Compiler.hs +++ b/src/Hakyll/Core/Compiler.hs @@ -254,9 +254,11 @@ cached :: (Binary a, Typeable a, Writable a) -> Compiler Resource a -> Compiler Resource a cached name (Compiler d j) = Compiler d $ const $ CompilerM $ do + logger <- compilerLogger <$> ask identifier <- compilerIdentifier <$> ask store <- compilerStore <$> ask modified <- compilerResourceModified <$> ask + report logger $ "Checking cache: " ++ if modified then "modified" else "OK" if modified then do v <- unCompilerM $ j $ Resource identifier liftIO $ storeSet store name identifier v diff --git a/src/Hakyll/Core/Logger.hs b/src/Hakyll/Core/Logger.hs index 8f5a4f9..720dee0 100644 --- a/src/Hakyll/Core/Logger.hs +++ b/src/Hakyll/Core/Logger.hs @@ -7,6 +7,7 @@ module Hakyll.Core.Logger , flushLogger , section , timed + , report ) where import Control.Monad (forever) @@ -79,3 +80,11 @@ timed logger msg action = do formatted = printf " [%4dms] %s" ms msg liftIO $ message logger formatted return result + +-- | Log something at the same level as 'timed', but without the timing +-- +report :: MonadIO m + => Logger -- ^ Logger + -> String -- ^ Message + -> m () -- ^ No result +report logger msg = liftIO $ message logger $ " [ ] " ++ msg |