packages feed

hslogger 1.2.9 → 1.2.10

raw patch · 4 files changed

+31/−17 lines, 4 filesdep +HUnitdep ~basePVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependencies added: HUnit

Dependency ranges changed: base

API changes (from Hackage documentation)

- System.Log: instance Bounded Priority
- System.Log: instance Enum Priority
- System.Log: instance Eq Priority
- System.Log: instance Ord Priority
- System.Log: instance Read Priority
- System.Log: instance Show Priority
- System.Log.Handler.Growl: instance LogHandler GrowlHandler
- System.Log.Handler.Log4jXML: instance Show XML
- System.Log.Handler.Simple: closeFunc :: GenericHandler a -> a -> IO ()
- System.Log.Handler.Simple: formatter :: GenericHandler a -> LogFormatter (GenericHandler a)
- System.Log.Handler.Simple: instance LogHandler (GenericHandler a)
- System.Log.Handler.Simple: priority :: GenericHandler a -> Priority
- System.Log.Handler.Simple: privData :: GenericHandler a -> a
- System.Log.Handler.Simple: writeFunc :: GenericHandler a -> a -> String -> IO ()
- System.Log.Handler.Syslog: instance Eq Facility
- System.Log.Handler.Syslog: instance Eq Option
- System.Log.Handler.Syslog: instance LogHandler SyslogHandler
- System.Log.Handler.Syslog: instance Read Facility
- System.Log.Handler.Syslog: instance Read Option
- System.Log.Handler.Syslog: instance Show Facility
- System.Log.Handler.Syslog: instance Show Option
+ System.Log: instance GHC.Classes.Eq System.Log.Priority
+ System.Log: instance GHC.Classes.Ord System.Log.Priority
+ System.Log: instance GHC.Enum.Bounded System.Log.Priority
+ System.Log: instance GHC.Enum.Enum System.Log.Priority
+ System.Log: instance GHC.Read.Read System.Log.Priority
+ System.Log: instance GHC.Show.Show System.Log.Priority
+ System.Log.Handler.Growl: instance System.Log.Handler.LogHandler System.Log.Handler.Growl.GrowlHandler
+ System.Log.Handler.Log4jXML: instance GHC.Show.Show System.Log.Handler.Log4jXML.XML
+ System.Log.Handler.Simple: [closeFunc] :: GenericHandler a -> a -> IO ()
+ System.Log.Handler.Simple: [formatter] :: GenericHandler a -> LogFormatter (GenericHandler a)
+ System.Log.Handler.Simple: [priority] :: GenericHandler a -> Priority
+ System.Log.Handler.Simple: [privData] :: GenericHandler a -> a
+ System.Log.Handler.Simple: [writeFunc] :: GenericHandler a -> a -> String -> IO ()
+ System.Log.Handler.Simple: instance System.Log.Handler.LogHandler (System.Log.Handler.Simple.GenericHandler a)
+ System.Log.Handler.Syslog: data SyslogHandler
+ System.Log.Handler.Syslog: instance GHC.Classes.Eq System.Log.Handler.Syslog.Facility
+ System.Log.Handler.Syslog: instance GHC.Classes.Eq System.Log.Handler.Syslog.Option
+ System.Log.Handler.Syslog: instance GHC.Read.Read System.Log.Handler.Syslog.Facility
+ System.Log.Handler.Syslog: instance GHC.Read.Read System.Log.Handler.Syslog.Option
+ System.Log.Handler.Syslog: instance GHC.Show.Show System.Log.Handler.Syslog.Facility
+ System.Log.Handler.Syslog: instance GHC.Show.Show System.Log.Handler.Syslog.Option
+ System.Log.Handler.Syslog: instance System.Log.Handler.LogHandler System.Log.Handler.Syslog.SyslogHandler
- System.Log.Formatter: type LogFormatter a = a -> LogRecord -> String -> IO String
+ System.Log.Formatter: type LogFormatter a = a The LogHandler that the passed message came from -> LogRecord The log message and priority -> String The logger name -> IO String The formatted log message

Files

hslogger.cabal view
@@ -1,5 +1,5 @@ Name: hslogger-Version: 1.2.9+Version: 1.2.10 License: BSD3 Maintainer: John Goerzen <jgoerzen@complete.org> Author: John Goerzen@@ -27,7 +27,10 @@     testsrc/Tests.hs,     testsrc/runtests.hs,     winbuild.bat-Cabal-Version: >= 1.6+Cabal-Version: >= 1.8+source-repository head+  type: git+  location: git@github.com:jgoerzen/hslogger.git  flag small_base   description: choose the new smaller, split-up base package.@@ -53,13 +56,15 @@     -- GHC-Options: -O2     Hs-Source-Dirs: src -Executable runtests+test-suite runtests+    type: exitcode-stdio-1.0     if flag(buildtests)       Buildable: True     else       Buildable: False     Main-Is: runtests.hs-    HS-Source-Dirs: testsrc, .+    HS-Source-Dirs: testsrc, ., src     Extensions: ExistentialQuantification, OverlappingInstances,         UndecidableInstances, CPP-+    build-depends: base+                 , HUnit
src/System/Log/Handler/Growl.hs view
@@ -39,12 +39,12 @@     getFormatter = formatter      emit gh lr _ = let pkt = buildNotification gh nmGeneralMsg lr-		   in mapM_ (sendNote (skt gh) pkt) (targets gh)+                   in  mapM_ (sendNote (skt gh) pkt) (targets gh)      close gh = let pkt = buildNotification gh nmClosingMsg-			 (WARNING, "Connection closing.")+                             (WARNING, "Connection closing.")                    s   = skt gh-	       in mapM_ (sendNote s pkt) (targets gh) >> sClose s+               in  mapM_ (sendNote s pkt) (targets gh) >> sClose s  sendNote :: Socket -> String -> HostAddress -> IO Int sendNote s pkt ha = sendTo s pkt (SockAddrInet 9887 ha)@@ -94,7 +94,7 @@                      foldl packIt [] appNotes,                      ['\x0' .. (chr (length appNotes - 1))] ]           packIt a b = a ++ (emitLen16 b) ++ b-	  appNotes = [ nmGeneralMsg, nmClosingMsg ]+          appNotes = [ nmGeneralMsg, nmClosingMsg ]           emitLen8 v = [chr $ length v]  {- | Adds a remote machine's address to the list of targets that will@@ -125,9 +125,9 @@ -- Creates a network packet containing a notification record.  buildNotification :: GrowlHandler-		  -> String+                  -> String                   -> LogRecord-		  -> String+                  -> String buildNotification gh nm (p, msg) = concat fields     where fields = [ ['\x1', '\x5'],                      emit16 (toFlags p),
src/System/Log/Handler/Syslog.hs view
@@ -29,6 +29,7 @@ -}  module System.Log.Handler.Syslog(+                                       SyslogHandler, -- No constructors.                                        -- * Handler Initialization                                        openlog,                                        -- * Advanced handler initialization@@ -247,7 +248,7 @@     getLevel sh = priority sh     setFormatter sh f = sh{formatter = f}     getFormatter sh = formatter sh-    emit sh (_, msg) _ = do+    emit sh (prio, msg) _ = do       when (elem PERROR (options sh)) (hPutStrLn stderr msg)       pidPart <- getPidPart       void $ sendstr (toSyslogFormat msg pidPart)@@ -261,7 +262,7 @@           sendstr (genericDrop sent omsg)         toSyslogFormat msg pidPart =             "<" ++ code ++ ">" ++ identity' ++ pidPart ++ ": " ++ msg ++ "\0"-        code = show (makeCode (facility sh) (priority sh))+        code = show $ makeCode (facility sh) prio         identity' = identity sh         getPidPart = if elem PID (options sh)                      then getPid >>= \pid -> return ("[" ++ pid ++ "]")
testsrc/Tests.hs view
@@ -1,14 +1,22 @@ {- arch-tag: Tests main file Copyright (C) 2004 John Goerzen <jgoerzen@complete.org> License: BSD3- -}- module Tests(tests) where+ import Test.HUnit -test1 = TestCase ("x" @=? "x")+import System.Log -tests = TestList [TestLabel "test1" test1]+tests = TestList [TestLabel "priority levels" priorityLevels] +priorityLevels :: Test+priorityLevels = TestList [+  TestCase ( DEBUG <= DEBUG @=? True),+  TestCase ( DEBUG <= INFO @=? True),+  TestCase ( INFO <= WARNING @=? True),+  TestCase ( WARNING <= ERROR @=? True),+  TestCase ( INFO <= ERROR @=? True),+  TestCase ( ERROR > INFO @=? True)+  ]