Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
hslogger benchmark
import Network.Socket
import System.Log.Logger
import System.Log.Handler.Syslog
openUDP = generalOpen
$ openlog_remote AF_INET "127.0.0.1" 514
openDevLog = generalOpen
$ openlog_local "/dev/log"
generalOpen f
= f "hslogger-test" [] LOCAL0 DEBUG
writeLog = warningM "test.logger" message
message = take 5000 $ cycle "criterion msg "
main = defaultMain
[ bgroup "log"
[ env (setupWith openUDP) $ \() -> bench "UDP"
$ nfIO writeLog
, env (setupWith openDevLog) $ \() -> bench "/dev/log"
$ nfIO writeLog
]
]
setupWith mkHandler = do
handler <- mkHandler
logger <- getRootLogger
saveGlobalLogger $ setHandlers [handler] logger
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.