Skip to content

Instantly share code, notes, and snippets.

@naoto-ogawa
Created May 24, 2017 13:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save naoto-ogawa/b2e64e57ed7c215ea9dbc6a3c4957639 to your computer and use it in GitHub Desktop.
Save naoto-ogawa/b2e64e57ed7c215ea9dbc6a3c4957639 to your computer and use it in GitHub Desktop.
a small sample (the smallest ?) of MonadLogger
{-
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