[Haskell-cafe] direct-fastcgi and logging
Erik Hesselink
hesselink at gmail.com
Thu Jun 26 07:42:27 UTC 2014
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
<haskell at dshevchenko.biz> wrote:
> 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 at dshevchenko.biz
>
>
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
More information about the Haskell-Cafe
mailing list