2017-12-24 21 views

答えて

0

クレジットはJoe Kachmar

{-# LANGUAGE OverloadedStrings #-} 
{-# LANGUAGE TemplateHaskell #-} 

module Main where 

import Control.Exception 
import Katip 
import System.IO (stdout) 

type Stack a = KatipContextT IO a 

-- `Stack()` is the same thing as `KatipContextT IO()` 
-- test :: Stack() 
test :: KatipContextT IO() 
test = do 
    $(logTM) InfoS "Hello from Katip!" 
    $(logTM) InfoS "I can do any kind of `IO` action here with `liftIO`!" 

main :: IO() 
main = do 
    handleScribe <- mkHandleScribe ColorIfTerminal stdout InfoS V2 
    let mkLogEnv = registerScribe "stdout" handleScribe defaultScribeSettings =<< initLogEnv "MyApp" "production" 

    bracket mkLogEnv closeScribes $ \le -> do 
    runKatipContextT le (mempty :: LogContexts) mempty test 
に行きます
関連する問題