rio 0.1.1.0 → 0.1.2.0
raw patch · 4 files changed
+21/−3 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ RIO: setLogUseLoc :: Bool -> LogOptions -> LogOptions
Files
- ChangeLog.md +3/−0
- README.md +3/−0
- rio.cabal +2/−2
- src/RIO/Prelude/Logger.hs +13/−1
ChangeLog.md view
@@ -1,4 +1,7 @@ # Changelog for rio+## 0.1.2.0++* Allow setting usage of code location in the log output ## 0.1.1.0
README.md view
@@ -152,6 +152,7 @@ InstanceSigs KindSignatures LambdaCase+MonadFailDesugaring MultiParamTypeClasses MultiWayIf NamedFieldPuns@@ -178,6 +179,8 @@ * Despite the fact that `OverloadedStrings` can break existing code, we recommend its usage to encourage avoidance of the `String` data type. Also, for new code, the risk of breakage is much lower.+* `MonadFailDesugaring` helps prevent partial pattern matches in your+ code, see [#85](https://github.com/commercialhaskell/rio/issues/85) __TODO__ Do we recommend setting in `package.yaml` or in the source files themselves? Need to discuss and come to a conclusion on this
rio.cabal view
@@ -2,10 +2,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 41f8f90d704c32652d5e506303e73626dc68f4097e4e73c37007937b54add786+-- hash: ceb8120bf0a35f85bf8e2dc1e5fe5cb70fabef54290d42e7051d631841b690ee name: rio-version: 0.1.1.0+version: 0.1.2.0 synopsis: A standard library for Haskell description: See README and Haddocks at <https://www.stackage.org/package/rio> category: Control
src/RIO/Prelude/Logger.hs view
@@ -19,6 +19,7 @@ , setLogTerminal , setLogUseTime , setLogUseColor+ , setLogUseLoc -- * Advanced logging functions -- ** Sticky logging , logSticky@@ -278,6 +279,7 @@ , logTerminal = True , logUseTime = False , logUseColor = False+ , logUseLoc = False , logSend = \new -> atomicModifyIORef' ref $ \old -> (old <> new, ()) } return (ref, options)@@ -302,6 +304,7 @@ , logTerminal = terminal , logUseTime = verbose , logUseColor = verbose && terminal+ , logUseLoc = verbose , logSend = \builder -> if useUtf8 && unicode then hPutBuilder handle' (builder <> flush)@@ -387,6 +390,7 @@ , logTerminal :: !Bool , logUseTime :: !Bool , logUseColor :: !Bool+ , logUseLoc :: !Bool , logSend :: !(Builder -> IO ()) } @@ -433,6 +437,14 @@ setLogUseColor :: Bool -> LogOptions -> LogOptions setLogUseColor c options = options { logUseColor = c } +-- | Use code location in the log output.+--+-- Default: true if in verbose mode, false otherwise.+--+-- @since 0.1.2.0+setLogUseLoc :: Bool -> LogOptions -> LogOptions+setLogUseLoc l options = options { logUseLoc = l }+ simpleLogFunc :: LogOptions -> CallStack -> LogSource -> LogLevel -> Utf8Builder -> IO () simpleLogFunc lo cs _src level msg = when (level >= logMinLevel lo) $ do@@ -485,7 +497,7 @@ getLoc :: Utf8Builder getLoc- | logVerboseFormat lo = ansi setBlack <> "\n@(" <> displayCallStack cs <> ")"+ | logUseLoc lo = ansi setBlack <> "\n@(" <> displayCallStack cs <> ")" | otherwise = mempty -- | Convert a 'CallStack' value into a 'Utf8Builder' indicating