snaplet-hslogger

Snap framework snaplet for the Logger API library. https://github.com/ixmatus/snaplet-logger

Latest on Hackage:1.0.0.2

This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow stackage.org to host generated Haddocks.

BSD3 licensed by Parnell Springmeyer
* Welcome!
[[https://hackage.haskell.org/package/snaplet-hslogger][https://img.shields.io/hackage/v/snaplet-hslogger.svg?style=flat]]
[[https://travis-ci.org/ixmatus/snaplet-hslogger][https://travis-ci.org/ixmatus/snaplet-hslogger.svg?branch=master]]

=snaplet-hslogger= provides a convenience interface to the Haskell
[[http://hackage.haskell.org/package/hslogger][HSLogger]] package.

#+BEGIN_SRC
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TemplateHaskell #-}

module Main where

------------------------------------------------------------------------------
import Control.Applicative
import Control.Lens
import System.Log
import Snap
import Snap.Snaplet.Log
import Text.Email.Validate

------------------------------------------------------------------------------
data App = App
{ _logger :: Snaplet ()
}

makeLenses ''App

------------------------------------------------------------------------------
-- | The application's routes.
routes :: [(ByteString, Handler App App ())]
routes = [ ("/" , writeText "hello")
, ("/foo" , fooHandler)
]

fooHandler :: Handler App App ()
fooHandler = do
log DEBUG "Message"
getResponse >>= finishWith


------------------------------------------------------------------------------
-- | The application initializer.
app :: SnapletInit App App
app = makeSnaplet "app" "An snaplet example application." Nothing $ do
m <- nestSnaplet "hslogger" logger $ initLogger
addRoutes routes
return $ App m


main :: IO ()
main = serveSnaplet defaultConfig app
#+END_SRC
Used by 1 package:
comments powered byDisqus