hslogger-template 0.2.1 → 0.2.2
raw patch · 4 files changed
+78/−65 lines, 4 filessetup-changedPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- Setup.hs +0/−13
- Setup.lhs +13/−0
- hslogger-template.cabal +21/−12
- src/System/Log/Logger/TH.hs +44/−40
− Setup.hs
@@ -1,13 +0,0 @@-module Main (main) where--import System.Cmd (system)--import Distribution.Simple (defaultMainWithHooks, runTests, simpleUserHooks)--main :: IO ()-main =- defaultMainWithHooks $- simpleUserHooks- { runTests = \_ _ _ _ ->- system "runhaskell -i./src -Wall -XTemplateHaskell src/test.hs" >> return ()- }
+ Setup.lhs view
@@ -0,0 +1,13 @@+#! /usr/bin/env runhaskell++> module Main (main) where+>+> import System.Cmd (system)+>+> import Distribution.Simple (defaultMainWithHooks, runTests, simpleUserHooks)+>+> main :: IO ()+> main =+> defaultMainWithHooks (simpleUserHooks { runTests = \_ _ _ _ -> system command >> return () })+> where+> command = "runhaskell -i./src -Wall -XTemplateHaskell src/test.hs"
hslogger-template.cabal view
@@ -1,25 +1,34 @@-name: hslogger-template-version: 0.2.1+name: hslogger-template+version: 0.2.2++category: Interfaces+ synopsis: Automatic generation of hslogger functions+ description: Library for generating hslogger functions using Template Haskell.-homepage: http://github.com/bsl/hslogger-template -license: PublicDomain author: Brian Lewis <brian@lorf.org>, Ian Taylor <ian@lorf.org> maintainer: Brian Lewis <brian@lorf.org>, Ian Taylor <ian@lorf.org>-category: Interfaces +license: PublicDomain++homepage: http://github.com/bsl/hslogger-template+ cabal-version: >= 1.6 build-type: Custom extra-source-files: src/test.hs library- exposed-modules: System.Log.Logger.TH- build-depends: base, haskell98, hslogger, template-haskell- extensions: TemplateHaskell- hs-source-dirs: src- ghc-options: -Wall- if impl(ghc >= 6.8)- ghc-options: -fwarn-tabs+ exposed-modules: System.Log.Logger.TH+ build-depends: base, haskell98, hslogger, template-haskell+ extensions: TemplateHaskell+ hs-source-dirs: src+ ghc-options: -Wall+ if impl(ghc >= 6.8)+ ghc-options: -fwarn-tabs++source-repository head+ type: git+ location: git://github.com/bsl/hslogger-template.git
src/System/Log/Logger/TH.hs view
@@ -1,49 +1,53 @@--- | This module provides functions that generate hslogger functions using--- Template Haskell.+{-|+ This module provides functions that generate hslogger functions using+ Template Haskell.+-} module System.Log.Logger.TH (deriveLoggers) where import qualified Language.Haskell.TH as TH import qualified System.Log.Logger as HSL --- | Generate hslogger functions for a list of priorities.------ Example usage:------ > module Foo.Bar ( ... ) where--- >--- > import System.Log.Logger.TH (deriveLoggers)--- > import qualified System.Log.Logger as HSL--- >--- > $(deriveLoggers "HSL" [HSL.DEBUG, HSL.INFO])------ Used this way, @deriveLoggers@ would generate the following functions:------ > infoM :: String -> IO ()--- > infoM s = HSL.infoM "Foo.Bar" ((++) "Foo.Bar: " s)--- >--- > debugM :: String -> IO ()--- > debugM s = HSL.debugM "Foo.Bar" ((++) "Foo.Bar: " s)------ The other hslogger priorities follow the same pattern.------ So------ > infoM "hi there"------ would generate the INFO-level log event------ > Foo.Bar: hi there------ Notes:------ * "System.Log.Logger" must be imported qualified, and the qualifier must--- match the qualifier given to @deriveLoggers@.------ * Don't forget to enable Template Haskell preprocessing: specify the--- pragma @LANGUAGE TemplateHaskell@ at the top of your source file or--- @extensions: TemplateHaskell@ in your cabal file, etc.---+{-|+ Generate hslogger functions for a list of priorities.++ Example usage:++ > module Foo.Bar ( ... ) where+ >+ > import System.Log.Logger.TH (deriveLoggers)+ > import qualified System.Log.Logger as HSL+ >+ > $(deriveLoggers "HSL" [HSL.DEBUG, HSL.INFO])++ Used this way, @deriveLoggers@ would generate the following functions:++ > infoM :: String -> IO ()+ > infoM s = HSL.infoM "Foo.Bar" ((++) "Foo.Bar: " s)+ >+ > debugM :: String -> IO ()+ > debugM s = HSL.debugM "Foo.Bar" ((++) "Foo.Bar: " s)++ The other hslogger priorities follow the same pattern.++ So++ > infoM "hi there"++ would generate the INFO-level log event++ > Foo.Bar: hi there++ Notes:++ * "System.Log.Logger" must be imported qualified, and the qualifier must+ match the qualifier given to @deriveLoggers@.++ * Don't forget to enable Template Haskell preprocessing: specify the+ pragma @LANGUAGE TemplateHaskell@ at the top of your source file or+ @extensions: TemplateHaskell@ in your cabal file, etc.+-}+ deriveLoggers :: String -- ^ Must match qualifier on import of "System.Log.Logger". -> [HSL.Priority] -- ^ List of priorities for which to generate logging functions.