co-log-json 0.0.1.0 → 0.1.0.0
raw patch · 4 files changed
+25/−15 lines, 4 filesdep ~aesondep ~bytestringdep ~co-log-corePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: aeson, bytestring, co-log-core, string-conv, text
API changes (from Hackage documentation)
Files
- Readme.md +4/−0
- co-log-json.cabal +18/−13
- src/Colog/Json.hs +1/−1
- src/Colog/Json/Action.hs +2/−1
Readme.md view
@@ -1,3 +1,7 @@+[](https://hackage.haskell.org/package/co-log-json)+[](https://github.com/qnikst/co-log-json/blob/master/LICENSE)++ # co-log-json `co-log-json` allows writing structured logs in your application.
co-log-json.cabal view
@@ -1,21 +1,21 @@-cabal-version: 3.0+cabal-version: 2.4 name: co-log-json-version: 0.0.1.0+version: 0.1.0.0 synopsis: Structured messages support in co-log ecosystem. description: The library implements of a very simple approach to structured logging, that ca be used with the [co-log](https://hackage.haskell.org/package/co-log) ecosystem or on it's own see [cheops-logger](https://github.com/cheopslab/cheops-logger).-+ . It provides:-+ . * "Colog.Json" — API for adding structured context to the log messages * "Colog.Json.Action" — efficient function for dumping logs in the following format.-+ . By default it emits logs in the following format (pretty-printed for convenience):-+ . @ { "namespace":"server.package" -- namespace for the component , "severity": \"DEBUG\" -- severity level@@ -30,7 +30,7 @@ } } @-+ . The most interesting thing here is the field @data@ that can be used by the user to add additional structured info to the message. @@ -39,12 +39,17 @@ license-file: LICENSE author: Alexander Vershilov maintainer: alexander.vershilov@sirius.online-copyright: (C) 2019-2020 Фонд Талант и Успех+copyright: (C) 2019-2023 Фонд Талант и Успех category: System extra-source-files: CHANGELOG.md Readme.md+tested-with:+ GHC ==9.2.2+ || ==9.0.2+ || ==8.10.7 + library exposed-modules: Colog.Json@@ -65,12 +70,12 @@ FlexibleContexts build-depends: base >=4.11 && <5- , aeson ^>= 1.5- , bytestring ^>=0.10- , text ^>=1.2+ , aeson >= 2.0 && < 2.2+ , bytestring >=0.10 && < 0.12+ , text >=1.2 && < 2.1 , containers ^>=0.6- , co-log-core ^>=0.2- , string-conv ^>=0.1+ , co-log-core >=0.2 && < 0.4+ , string-conv >=0.1 && < 0.3 hs-source-dirs: src ghc-options: -Wall default-language: Haskell2010
src/Colog/Json.hs view
@@ -185,7 +185,7 @@ logErr, logAlert, logCrit, logEmergency :: MonadIO m => LoggerEnv -> LogStr -> m () logDebug x = logSay x DebugS-logNotice x = logSay x InfoS+logNotice x = logSay x NoticeS logInfo x = logSay x InfoS logWarn x = logSay x WarningS logErr x = logSay x ErrorS
src/Colog/Json/Action.hs view
@@ -10,6 +10,7 @@ import Colog.Json.Internal.Structured import Control.Exception import Data.Aeson.Encoding as Aeson+import qualified Data.Aeson.Key as Aeson.Key import qualified Data.ByteString.Builder as Builder import Data.Coerce import Data.Foldable@@ -102,7 +103,7 @@ | Segment tm <- toList attributes ] user_data = fold <$> NE.nonEmpty- [ pair key attributeValue+ [ pair (Aeson.Key.fromText key) attributeValue | Attr key attributeValue <- toList attributes ]