Hello community, here is the log from the commit of package ghc-rio for openSUSE:Factory checked in at 2019-08-29 17:22:24 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-rio (Old) and /work/SRC/openSUSE:Factory/.ghc-rio.new.7948 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-rio" Thu Aug 29 17:22:24 2019 rev:10 rq:726815 version:0.1.12.0 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-rio/ghc-rio.changes 2019-08-13 13:15:21.669504355 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-rio.new.7948/ghc-rio.changes 2019-08-29 17:22:28.587317898 +0200 @@ -1,0 +2,8 @@ +Tue Aug 27 02:01:53 UTC 2019 - [email protected] + +- Update rio to version 0.1.12.0. + ## 0.1.12.0 + + * Add `logFormat` and `setLogFormat` for `LogOptions`. + +------------------------------------------------------------------- Old: ---- rio-0.1.11.0.tar.gz New: ---- rio-0.1.12.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-rio.spec ++++++ --- /var/tmp/diff_new_pack.yVlKCj/_old 2019-08-29 17:22:30.559317570 +0200 +++ /var/tmp/diff_new_pack.yVlKCj/_new 2019-08-29 17:22:30.559317570 +0200 @@ -19,7 +19,7 @@ %global pkg_name rio %bcond_with tests Name: ghc-%{pkg_name} -Version: 0.1.11.0 +Version: 0.1.12.0 Release: 0 Summary: A standard library for Haskell License: MIT ++++++ rio-0.1.11.0.tar.gz -> rio-0.1.12.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rio-0.1.11.0/ChangeLog.md new/rio-0.1.12.0/ChangeLog.md --- old/rio-0.1.11.0/ChangeLog.md 2019-07-15 17:53:55.000000000 +0200 +++ new/rio-0.1.12.0/ChangeLog.md 2019-08-26 15:03:09.000000000 +0200 @@ -1,5 +1,9 @@ # Changelog for rio +## 0.1.12.0 + +* Add `logFormat` and `setLogFormat` for `LogOptions`. + ## 0.1.11.0 * Replace atomic and durable file writing functions with the ones from `unliftio`, see [#167](https://github.com/commercialhaskell/rio/pull/167) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rio-0.1.11.0/README.md new/rio-0.1.12.0/README.md --- old/rio-0.1.11.0/README.md 2019-03-18 06:52:56.000000000 +0100 +++ new/rio-0.1.12.0/README.md 2019-08-26 15:03:09.000000000 +0200 @@ -208,7 +208,7 @@ * `-Wpartial-fields` * `-Wredundant-constraints` -You may add them per file, or to your package.yaml, or pass them on +You may add them per file, or to your `package.yaml`, or pass them on the command line when running ghc. We include these in the project template's `package.yaml` file. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rio-0.1.11.0/rio.cabal new/rio-0.1.12.0/rio.cabal --- old/rio-0.1.11.0/rio.cabal 2019-07-15 17:54:02.000000000 +0200 +++ new/rio-0.1.12.0/rio.cabal 2019-08-26 15:04:07.000000000 +0200 @@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack -- --- hash: 2a45e44bfde95330afa0baab193dbd03b0e1065480a3a90f4d1b5cc5de3a4556 +-- hash: 7dc639bd135a48a7ddeeaf2a43e7de51ccc95f000475f44c042aaa133defb453 name: rio -version: 0.1.11.0 +version: 0.1.12.0 synopsis: A standard library for Haskell description: See README and Haddocks at <https://www.stackage.org/package/rio> category: Control diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rio-0.1.11.0/src/RIO/Prelude/Logger.hs new/rio-0.1.12.0/src/RIO/Prelude/Logger.hs --- old/rio-0.1.11.0/src/RIO/Prelude/Logger.hs 2019-06-26 06:57:48.000000000 +0200 +++ new/rio-0.1.12.0/src/RIO/Prelude/Logger.hs 2019-08-26 15:03:09.000000000 +0200 @@ -19,6 +19,7 @@ , setLogUseTime , setLogUseColor , setLogUseLoc + , setLogFormat -- ** Standard logging functions , logDebug , logInfo @@ -287,6 +288,7 @@ , logUseTime = False , logUseColor = False , logUseLoc = False + , logFormat = id , logSend = \new -> atomicModifyIORef' ref $ \old -> (old <> new, ()) } return (ref, options) @@ -324,6 +326,7 @@ , logUseColor = verbose && terminal #endif , logUseLoc = verbose + , logFormat = id , logSend = \builder -> if useUtf8 && unicode then hPutBuilder handle' (builder <> flush) @@ -425,6 +428,7 @@ , logUseTime :: !Bool , logUseColor :: !Bool , logUseLoc :: !Bool + , logFormat :: !(Utf8Builder -> Utf8Builder) , logSend :: !(Builder -> IO ()) } @@ -498,6 +502,14 @@ setLogUseLoc :: Bool -> LogOptions -> LogOptions setLogUseLoc l options = options { logUseLoc = l } +-- | Set format method for messages +-- +-- Default: `id` +-- +-- @since 0.1.12.0 +setLogFormat :: (Utf8Builder -> Utf8Builder) -> LogOptions -> LogOptions +setLogFormat f options = options { logFormat = f } + simpleLogFunc :: LogOptions -> CallStack -> LogSource -> LogLevel -> Utf8Builder -> IO () simpleLogFunc lo cs _src level msg = do logLevel <- logMinLevel lo @@ -509,7 +521,7 @@ timestamp <> getLevel logVerbose <> ansi reset <> - msg <> + logFormat lo msg <> getLoc <> ansi reset <> "\n" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rio-0.1.11.0/test/RIO/LoggerSpec.hs new/rio-0.1.12.0/test/RIO/LoggerSpec.hs --- old/rio-0.1.11.0/test/RIO/LoggerSpec.hs 2019-06-26 06:57:48.000000000 +0200 +++ new/rio-0.1.12.0/test/RIO/LoggerSpec.hs 2019-08-26 15:03:09.000000000 +0200 @@ -67,3 +67,10 @@ noLogging $ logInfo "should not appear" builder <- readIORef ref toLazyByteString builder `shouldBe` "[info] should appear\n" + it "setLogFormat" $ do + (ref, options) <- logOptionsMemory + let format = ("[context] " <>) + withLogFunc (options & setLogFormat format) $ \lf -> runRIO lf $ do + logInfo "should be formatted" + builder <- readIORef ref + toLazyByteString builder `shouldBe` "[context] should be formatted\n"
