monad-logger-json

JSON-friendly Logging APIs http://github.com/fpco/monad-logger-json

Version on this page:0.1.0.0
LTS Haskell 8.12:0.1.0.0
Stackage Nightly 2017-04-24:0.1.0.0
Latest on Hackage:0.1.0.0
MIT licensed by FP Complete Developers
Maintained by dev@fpcomplete.com

Module documentation for 0.1.0.0

Monad Logger functions for JSON

TravisCI Hackage

Install

As a library:

cabal install monad-logger-json

Usage (example)

{-# LANGUAGE TemplateHaskell #-}

import Control.Monad.IO.Class ( MonadIO(liftIO) )
import Control.Monad.Logger ( runStdoutLoggingT )
import Control.Monad.Logger.JSON ( logInfoJ, logDebugJ )
import Data.Aeson.TH ( defaultOptions, deriveJSON )
import Data.Time.Clock ( UTCTime, getCurrentTime )

data Message = Message { time :: UTCTime }

$( deriveJSON defaultOptions ''Message )

main :: IO ()
main =
  runStdoutLoggingT
    (do now <- liftIO getCurrentTime
        $logDebugJ (Message now)
        $logInfoJ "Hello world")
comments powered byDisqus