From 5572dbc8289de934e9ee5bc3f74a0f98365ce3e5 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 21 Apr 2017 17:42:10 -0400 Subject: initial http server Incomplete, but the client is able to connect and send messages which get logged. Split up debug-me.hs into Role/* Switched from cereal to binary, since websockets operate on lazy ByteStrings, and using cereal would involve a copy on every receive. This commit was sponsored by Boyd Stephen Smith Jr. on Patreon. --- Log.hs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Log.hs') diff --git a/Log.hs b/Log.hs index 05cbdc3..ec7078e 100644 --- a/Log.hs +++ b/Log.hs @@ -71,6 +71,10 @@ withLogger logfile a = withFile logfile WriteMode (a . mkLogger) mkLogger :: Handle -> Logger mkLogger h a = do l <- mkLog a <$> getPOSIXTime + writeLogHandle l h + +writeLogHandle :: Log -> Handle -> IO () +writeLogHandle l h = do L.hPut h (encode l) hPutStr h "\n" hFlush h -- cgit v1.2.3