packages feed

fluent-logger 0.2.3.0 → 0.2.3.1

raw patch · 4 files changed

+39/−2 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

fluent-logger.cabal view
@@ -1,5 +1,5 @@ name:                fluent-logger-version:             0.2.3.0+version:             0.2.3.1 synopsis:            A structured logger for Fluentd (Haskell) description:         A structured logger for Fluentd (Haskell) <http://fluentd.org/> license:             Apache-2.0
src/Network/Fluent/Logger.hs view
@@ -31,12 +31,15 @@  import qualified Data.ByteString.Char8 as BS ( ByteString, pack, unpack, empty, null) import qualified Data.ByteString.Lazy as LBS ( ByteString, length )+#if MIN_VERSION_base(4,8,0)+#else+import Control.Applicative ( (<$>) ) import Data.Monoid ( mconcat )+#endif import qualified Network.Socket as NS import Network.Socket.Options ( setRecvTimeout, setSendTimeout ) import Network.Socket.ByteString.Lazy ( sendAll, recv ) import Control.Monad ( void, forever, when )-import Control.Applicative ( (<$>) ) import Control.Concurrent ( ThreadId, killThread, threadDelay ) import Control.Concurrent.STM ( atomically, orElse                               , TChan, newTChanIO, readTChan, peekTChan, writeTChan
src/Network/Fluent/Logger/Packable.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE FlexibleInstances, IncoherentInstances, TypeSynonymInstances #-}+{-# LANGUAGE CPP #-} -- | For compatibility with msgpack module Network.Fluent.Logger.Packable (Packable(..)) where @@ -7,6 +8,10 @@ import qualified Data.Vector as V import qualified Data.Text as T import qualified Data.Text.Lazy as LT+#if MIN_VERSION_messagepack(0,4,0)+import qualified Data.Text.Encoding as T+import qualified Data.Text.Lazy.Encoding as LT+#endif import qualified Data.ByteString.Char8 as BS import qualified Data.ByteString.Lazy as LBS @@ -27,7 +32,11 @@     pack = ObjectInt . fromIntegral  instance Packable String where+#if MIN_VERSION_messagepack(0,4,0)+    pack = ObjectString . BS.pack+#else     pack = ObjectString . T.pack+#endif  instance Packable BS.ByteString where     pack = ObjectBinary@@ -36,10 +45,18 @@     pack = ObjectBinary . LBS.toStrict  instance Packable T.Text where+#if MIN_VERSION_messagepack(0,4,0)+    pack = ObjectString . T.encodeUtf8+#else     pack = ObjectString+#endif  instance Packable LT.Text where+#if MIN_VERSION_messagepack(0,4,0)+    pack = pack . LT.encodeUtf8+#else     pack = ObjectString . T.pack . LT.unpack+#endif  instance Packable a => Packable [a] where     pack = ObjectArray . map pack
test/Network/Fluent/Logger/Unpackable.hs view
@@ -1,5 +1,6 @@ {-# LANGUAGE FlexibleInstances, IncoherentInstances, TypeSynonymInstances #-} {-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE CPP #-} -- | For compatibility with msgpack module Network.Fluent.Logger.Unpackable where @@ -9,6 +10,10 @@ import qualified Data.Map as M import qualified Data.Text as T import qualified Data.Text.Lazy as LT+#if MIN_VERSION_messagepack(0,4,0)+import qualified Data.Text.Encoding as T+import qualified Data.Text.Lazy.Encoding as LT+#endif import qualified Data.ByteString.Char8 as BS import qualified Data.ByteString.Lazy as LBS @@ -37,7 +42,11 @@     unpack x = throw $ UnpackError $ "invalid for int: " ++ show x  instance Unpackable String where+#if MIN_VERSION_messagepack(0,4,0)+    unpack (ObjectString x) = BS.unpack x+#else     unpack (ObjectString x) = T.unpack x+#endif     unpack x = throw $ UnpackError $ "invalid for string: " ++ show x  instance Unpackable BS.ByteString where@@ -49,11 +58,19 @@     unpack x = throw $ UnpackError $ "invalid for binary: " ++ show x  instance Unpackable T.Text where+#if MIN_VERSION_messagepack(0,4,0)+    unpack (ObjectString x) = T.decodeUtf8 x+#else     unpack (ObjectString x) = x+#endif     unpack x = throw $ UnpackError $ "invalid for string: " ++ show x  instance Unpackable LT.Text where+#if MIN_VERSION_messagepack(0,4,0)+    unpack x@(ObjectString _) = LT.decodeUtf8 . unpack $ x+#else     unpack (ObjectString x) = LT.pack . T.unpack $ x+#endif     unpack x = throw $ UnpackError $ "invalid for string: " ++ show x  instance (Unpackable a1, Unpackable a2) => Unpackable (a1, a2) where