Created
May 24, 2017 13:27
-
-
Save naoto-ogawa/b2e64e57ed7c215ea9dbc6a3c4957639 to your computer and use it in GitHub Desktop.
a small sample (the smallest ?) of MonadLogger
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{- | |
a small sample (the smallest ?) of MonadLogger | |
-} | |
{-# LANGUAGE TemplateHaskell #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
module MonadLoggerSample where | |
import Control.Monad.Logger | |
import Language.Haskell.TH | |
import Data.Text | |
main :: IO () | |
main = do | |
print "abc" | |
runStderrLoggingT $ $(logDebug) "This is a debug log message" | |
print "xyz" | |
-- | |
-- runStderrLoggingT :: LoggingT IO () -> IO () | |
-- $(logDebug) :: Text -> LoggingT IO () | |
{- | |
*> :l MyLog02.hs | |
[1 of 1] Compiling MonadLoggerSample ( MyLog02.hs, interpreted ) | |
Ok, modules loaded: MonadLoggerSample. | |
*> main | |
"abc" | |
[Debug] This is a debug log message @(main:MonadLoggerSample MyLog02.hs:17:25) | |
"xyz" | |
-} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment