packages feed

log-elasticsearch 0.11.0.0 → 0.12.0.0

raw patch · 4 files changed

+12/−21 lines, 4 filesdep ~log-basePVP ok

version bump matches the API change (PVP)

Dependency ranges changed: log-base

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -1,3 +1,6 @@+# log-elasticsearch-0.12.0.0 (2021-06-09)+* Stop putting `insertion_time` and `insertion_order` in ElasticSearch.+ # log-elasticsearch-0.11.0.0 (2020-08-24) * Drop dependency on bloodhound * Unify V1 and V5 specific modules
log-elasticsearch.cabal view
@@ -1,5 +1,5 @@ name:                log-elasticsearch-version:             0.11.0.0+version:             0.12.0.0 synopsis:            Structured logging solution (Elasticsearch back end)  description:         Elasticsearch back end for the 'log' library suite.@@ -18,7 +18,8 @@ build-type:          Simple cabal-version:       >=1.10 extra-source-files:  CHANGELOG.md, README.md-tested-with:         GHC ==8.0.2 || ==8.2.2 || ==8.4.4 || ==8.6.5 || ==8.8.4 || ==8.10.2+tested-with:         GHC ==8.0.2 || ==8.2.2 || ==8.4.4 || ==8.6.5 || ==8.8.4 || ==8.10.4+                      || ==9.0.1  Source-repository head   Type:     git@@ -29,15 +30,15 @@                        Log.Backend.ElasticSearch.Internal                        Log.Backend.ElasticSearch.Lens   build-depends:       base >= 4.8 && <5,-                       log-base >= 0.7,                        aeson >=1.0.0.0,                        aeson-pretty >=0.8.2,-                       bytestring,                        base64-bytestring,+                       bytestring,                        deepseq,                        http-client,                        http-client-tls,                        http-types,+                       log-base >= 0.10 && <0.11,                        network-uri,                        semigroups,                        text,
src/Log/Backend/ElasticSearch.hs view
@@ -25,7 +25,6 @@ import Data.Maybe import Data.Semigroup import Data.Time-import Data.Word import Log import Log.Internal.Logger import Network.HTTP.Client@@ -99,7 +98,7 @@           unless (isSuccess reply) $ do             printEsError "error while creating index" $ responseBody reply         writeIORef indexRef index-      let jsonMsgs = V.fromList $ map (toJsonMsg now) $ zip [1..] msgs+      let jsonMsgs = V.fromList $ map toJsonMsg msgs       reply <- responseBody <$> bulkIndex version env esConf index jsonMsgs       -- Try to parse parts of reply to get information about log messages that       -- failed to be inserted for some reason.@@ -195,13 +194,8 @@                . T.toLazyText                . encodePrettyToTextBuilder' defConfig { confIndent = Spaces 2 } -    toJsonMsg :: UTCTime -> (Word32, LogMessage) -> H.HashMap T.Text Value-    toJsonMsg now (n, msg) = H.union jMsg $ H.fromList-      [ ("insertion_order", toJSON n)-      , ("insertion_time",  toJSON now)-      ]-      where-        Object jMsg = toJSON msg+    toJsonMsg :: LogMessage -> H.HashMap T.Text Value+    toJsonMsg msg = let Object jMsg = toJSON msg in jMsg  ---------------------------------------- 
src/Log/Backend/ElasticSearch/Internal.hs view
@@ -135,14 +135,7 @@   where     logsMapping = object       [ "properties" .= object-        [ "insertion_order" .= object-          [ "type" .= ("integer"::T.Text)-          ]-        , "insertion_time" .= object-          [ "type"   .= ("date"::T.Text)-          , "format" .= ("date_time"::T.Text)-          ]-        , "time" .= object+        [ "time" .= object           [ "type"   .= ("date"::T.Text)           , "format" .= ("date_time"::T.Text)           ]