packages feed

hsyslog-udp 0.1.2 → 0.2.0

raw patch · 4 files changed

+25/−22 lines, 4 filesdep ~bytestringdep ~hspecdep ~hsyslognew-uploaderPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: bytestring, hspec, hsyslog, network, text, time, unix

API changes (from Hackage documentation)

- System.Posix.Syslog.UDP: AUTH :: Facility
- System.Posix.Syslog.UDP: AUTHPRIV :: Facility
- System.Posix.Syslog.UDP: CRON :: Facility
- System.Posix.Syslog.UDP: DAEMON :: Facility
- System.Posix.Syslog.UDP: FTP :: Facility
- System.Posix.Syslog.UDP: KERN :: Facility
- System.Posix.Syslog.UDP: LOCAL0 :: Facility
- System.Posix.Syslog.UDP: LOCAL1 :: Facility
- System.Posix.Syslog.UDP: LOCAL2 :: Facility
- System.Posix.Syslog.UDP: LOCAL3 :: Facility
- System.Posix.Syslog.UDP: LOCAL4 :: Facility
- System.Posix.Syslog.UDP: LOCAL5 :: Facility
- System.Posix.Syslog.UDP: LOCAL6 :: Facility
- System.Posix.Syslog.UDP: LOCAL7 :: Facility
- System.Posix.Syslog.UDP: MAIL :: Facility
- System.Posix.Syslog.UDP: Mask :: [Priority] -> PriorityMask
- System.Posix.Syslog.UDP: NEWS :: Facility
- System.Posix.Syslog.UDP: NoMask :: PriorityMask
- System.Posix.Syslog.UDP: SYSLOG :: Facility
- System.Posix.Syslog.UDP: USER :: Facility
- System.Posix.Syslog.UDP: UpTo :: Priority -> PriorityMask
- System.Posix.Syslog.UDP: data PriorityMask :: *
+ System.Posix.Syslog.UDP: Auth :: Facility
+ System.Posix.Syslog.UDP: Cron :: Facility
+ System.Posix.Syslog.UDP: Daemon :: Facility
+ System.Posix.Syslog.UDP: Kernel :: Facility
+ System.Posix.Syslog.UDP: Local0 :: Facility
+ System.Posix.Syslog.UDP: Local1 :: Facility
+ System.Posix.Syslog.UDP: Local2 :: Facility
+ System.Posix.Syslog.UDP: Local3 :: Facility
+ System.Posix.Syslog.UDP: Local4 :: Facility
+ System.Posix.Syslog.UDP: Local5 :: Facility
+ System.Posix.Syslog.UDP: Local6 :: Facility
+ System.Posix.Syslog.UDP: Local7 :: Facility
+ System.Posix.Syslog.UDP: Mail :: Facility
+ System.Posix.Syslog.UDP: News :: Facility
+ System.Posix.Syslog.UDP: User :: Facility
- System.Posix.Syslog.UDP: type SeverityMask = PriorityMask
+ System.Posix.Syslog.UDP: type SeverityMask = [Priority]

Files

hsyslog-udp.cabal view
@@ -1,5 +1,5 @@ name:                   hsyslog-udp-version:                0.1.2+version:                0.2.0 synopsis:               Log to syslog over a network via UDP description:            Supports <https://tools.ietf.org/html/rfc5424 RFC 5424>,                         <https://tools.ietf.org/html/rfc3164 RFC 3164>, or any@@ -26,12 +26,12 @@   exposed-modules:      System.Posix.Syslog.UDP    Build-Depends:        base >= 3 && < 5-                      , bytestring == 0.10.*-                      , hsyslog == 4.*-                      , network == 2.6.*-                      , text == 1.2.*-                      , time < 1.7-                      , unix == 2.7.*+                      , bytestring < 0.11+                      , hsyslog >= 5 && < 6+                      , network < 2.7+                      , text < 1.3+                      , time < 1.9+                      , unix < 2.8  test-suite specs   default-language:     Haskell2010@@ -41,6 +41,6 @@   other-modules:        System.Posix.Syslog.UDPSpec    Build-Depends:        base >= 3 && < 5-                      , hspec == 2.2.*+                      , hspec < 2.5                       , hsyslog-udp-                      , time < 1.7+                      , time < 1.9
src/System/Posix/Syslog/UDP.hs view
@@ -23,7 +23,6 @@     -- ** Re-exports from <http://hackage.haskell.org/package/hsyslog hsyslog>     L.Priority (..)   , L.Facility (..)-  , L.PriorityMask (..)     -- ** Newtypes for various String/Int values     -- | Refer to     -- <https://tools.ietf.org/html/rfc5424#section-6.2 RFC 5424 section 6.2>@@ -67,7 +66,7 @@  import Control.Exception (SomeException, catch) import Control.Monad (void)-import Data.Bits ((.&.))+import Data.Bits ((.|.)) import Data.ByteString (ByteString) import Data.Monoid ((<>)) import Data.Text (Text)@@ -84,9 +83,11 @@ import qualified Network.Socket.ByteString as SB import qualified System.Posix.Process as P import qualified System.Posix.Syslog as L+import System.Posix.Syslog.Facility (fromFacility)+import System.Posix.Syslog.Priority (fromPriority)  type Severity = L.Priority-type SeverityMask = L.PriorityMask+type SeverityMask = [L.Priority]  type Protocol   =  PriVal@@ -197,7 +198,7 @@     processId <- getProcessId     return SyslogConfig {..}   where-    severityMask = L.NoMask+    severityMask = [minBound..maxBound]     address = localhost     protocol = rfc3164Protocol @@ -369,12 +370,12 @@   -> Severity   -> Maybe PriVal maskedPriVal mask fac sev-    | mask == L.NoMask = prival     | masked = Nothing     | otherwise = prival   where-    prival = Just . PriVal $ L.makePri fac sev-    masked = L._LOG_MASK (L.fromPriority sev) .&. L.fromPriorityMask mask == 0+    priority = fromFacility fac .|. fromPriority sev+    prival = Just $ PriVal priority+    masked = not $ sev `elem` mask  -- internal functions 
test/Main.hs view
@@ -14,7 +14,7 @@ logMessages :: IO () logMessages = do     syslog <- defaultConfig >>= initSyslog-    syslog USER Debug "hello thar!"+    syslog User Debug "hello thar!"  runSpecs :: IO () runSpecs =
test/System/Posix/Syslog/UDPSpec.hs view
@@ -10,17 +10,19 @@  spec :: Spec spec = do+  let upTo x = [minBound..x]+      noMask = [minBound..maxBound]   describe "maskedPriVal" $ do     it "returns a Just if priorities remain after masking" $-      let result = maskedPriVal (UpTo Debug) LOCAL4 Notice+      let result = maskedPriVal (upTo Debug) Local4 Notice       in result `shouldBe` Just (PriVal 165)      it "returns Nothing if all priorities are masked" $-      let result = maskedPriVal (UpTo Info) USER Debug+      let result = maskedPriVal (upTo Info) User Debug       in result `shouldBe` Nothing    describe "rfc5424Packet" $ do-    let (Just priVal) = maskedPriVal NoMask USER Debug+    let (Just priVal) = maskedPriVal noMask User Debug      it "uses the NILVALUE for Nothing values" $       let@@ -56,7 +58,7 @@    describe "rfc3164Packet" $ do     let-      (Just priVal) = maskedPriVal NoMask USER Debug+      (Just priVal) = maskedPriVal noMask User Debug       (Just time) = parseTimeM True defaultTimeLocale "%FT%X%QZ" "2003-10-11T22:14:15.003Z" :: Maybe UTCTime      it "correctly formats the message" $@@ -68,7 +70,7 @@    describe "rsyslogPacket" $ do     let-      (Just priVal) = maskedPriVal NoMask USER Debug+      (Just priVal) = maskedPriVal noMask User Debug       (Just time) = parseTimeM True defaultTimeLocale "%FT%X%QZ" "2003-10-11T22:14:15.003Z" :: Maybe UTCTime      it "correctly formats the message" $