
FastCGI seems to be just a ReaderT over IO, so you can just use liftIO
to perform arbitrary IO, like writing to a file. If you want something
more full-featured, you could use something like hslogger.
Regards,
Erik
On Thu, Jun 26, 2014 at 9:19 AM, Denis Shevchenko
Hi all!
I write a FastCGI-server based on excellent package 'direct-fastcgi' (http://hackage.haskell.org/package/direct-fastcgi). It works perfectly, but I want to inject a logging facility into a handler of requests. For example:
import Control.Concurrent (forkIO) import Network.FastCGI
main :: IO () main = acceptLoop forkIO handleRequest
handleRequest :: FastCGI () handleRequest = do -- >>> In this place I want to log a message <<< setResponseStatus 400 setResponseHeader HttpContentType "application/json" fPutStr "{ "my": "problem_description" }"
Yes, I know about this function in 'Network.FastCGI':
fLog :: MonadFastCGI m => String -> m ()
but it "logs a message using the web server's logging facility", and I want to log into _my_own_ file. So which solution I can use here? I'd be very grateful for any help.
---------- Sincerely, Denis Shevchenko haskell@dshevchenko.biz
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe