packages feed

log-postgres 0.7.0.2 → 0.7.1.0

raw patch · 4 files changed

+23/−19 lines, 4 filesdep ~aesonsetup-changed

Dependency ranges changed: aeson

Files

CHANGELOG.md view
@@ -1,3 +1,6 @@+# log-postgres-0.7.1.0 (2019-05-15)+* Support latest aeson.+ # log-postgres-0.7.0.2 (2017-08-10) * Update package description. 
− Setup.hs
@@ -1,2 +0,0 @@-import Distribution.Simple-main = defaultMain
log-postgres.cabal view
@@ -1,5 +1,6 @@+cabal-version:       2.0 name:                log-postgres-version:             0.7.0.2+version:             0.7.1.0 synopsis:            Structured logging solution (PostgreSQL back end)  description:         PostgreSQL back end for the 'log' library suite.@@ -16,9 +17,9 @@ copyright:           Scrive AB category:            System build-type:          Simple-cabal-version:       >=1.10 extra-source-files:  CHANGELOG.md, README.md-tested-with:         GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.1+tested-with:         GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.4,+                     GHC == 8.6.2  Source-repository head   Type:     git@@ -26,9 +27,9 @@  library   exposed-modules:     Log.Backend.PostgreSQL-  build-depends:       base <5,+  build-depends:       base >= 4.8 && <5,                        log-base >= 0.7,-                       aeson >=0.11.0.0,+                       aeson >=1.0 && < 1.4 || ^>= 1.4,                        aeson-pretty >=0.8.2,                        bytestring,                        base64-bytestring,
src/Log/Backend/PostgreSQL.hs view
@@ -5,16 +5,15 @@ import Control.Concurrent import Control.Exception.Lifted import Control.Monad.State.Lazy-import Data.Aeson+import Data.Aeson ((.=), Value(..), object, encode) import Data.List.Split import Data.Monoid.Utils-import Data.Semigroup import Data.String import Data.Typeable import Database.PostgreSQL.PQTypes import Prelude import qualified Data.ByteString.Base64 as B64-import qualified Data.Foldable as F+import qualified Data.Foldable as Foldable import qualified Data.HashMap.Strict as H import qualified Data.Text as T import qualified Data.Text.Encoding as T@@ -119,10 +118,10 @@     addPair :: Value -> (T.Text, Value) -> Value     addPair data_ (name, value) = case data_ of       Object obj -> Object $ H.insert name value obj-      _          -> object [-          "_data" .= data_-        , "_log"  .= value-        ]+      _          -> object+                    [ "_data" .= data_+                    , "_log"  .= value+                    ]      getEncodingQueryError :: DBException -> Maybe DetailedQueryError     getEncodingQueryError DBException{..}@@ -155,11 +154,14 @@       }       where         doValue :: Value -> m Value-        doValue (Object obj) = Object <$> F.foldrM (\(name, value) acc -> H.insert-          <$> doText name <*> doValue value <*> pure acc) H.empty (H.toList obj)-        doValue (Array arr) = Array <$> V.mapM doValue arr-        doValue (String s) = String <$> doText s-        doValue v = return v+        doValue (Object obj) =+          Object <$> Foldable.foldrM+          (\(name, value) acc ->+             H.insert <$> doText name <*> doValue value <*> pure acc)+          H.empty (H.toList obj)+        doValue (Array arr)  = Array <$> V.mapM doValue arr+        doValue (String s)   = String <$> doText s+        doValue v            = return v      sqlifyMessage :: (Int, LogMessage) -> SQL     sqlifyMessage (n, LogMessage{..}) = mconcat [