-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{-# LANGUAGE OverloadedLists #-} | ||
{-# LANGUAGE OverloadedLabels #-} | ||
{-# LANGUAGE OverloadedStrings #-} | ||
module Main where | ||
|
||
import Control.Concurrent (threadDelay) | ||
import Control.Exception (bracket) | ||
import Control.Monad.Reader | ||
import Herp.Logger as Logger | ||
import Herp.Logger.StdoutTransport | ||
import System.Log.FastLogger.LoggerSet as LS | ||
|
||
main :: IO () | ||
main = bracket (LS.newStdoutLoggerSet 4096) LS.rmLoggerSet $ \loggerSet -> do | ||
|
||
logger <- Logger.new 1 Debug [stdoutTransport loggerSet Debug] | ||
|
||
flip runReaderT logger $ do | ||
logM [ #debug, "debug" ] | ||
logM [ #info, "hello, world", "key" .= ("value" :: String) ] | ||
logM [ #notice, "lorem ipsum" ] | ||
logM [ #warn, "lorem ipsum" ] | ||
logM [ #error, "lorem ipsum" ] | ||
logM [ #crit, "lorem ipsum" ] | ||
logM [ #alert, "lorem ipsum" ] | ||
logM [ #emerg, "lorem ipsum" ] | ||
|
||
loggerCleanup logger |