diff options
author | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2011-02-21 13:15:11 +0100 |
---|---|---|
committer | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2011-02-21 13:15:11 +0100 |
commit | 917829539cfe61a55bb1dd16bf91b00011ce8dd2 (patch) | |
tree | 764e7f54d87696d980cbeb45bf479fb894c456dd | |
parent | 8b57ab509f9fbf7bb2058251beb60f39e8b476ca (diff) | |
download | hakyll-917829539cfe61a55bb1dd16bf91b00011ce8dd2.tar.gz |
Add report function to logger
-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 |