Blammo 2.1.0.0 → 2.1.1.0
raw patch · 6 files changed
+40/−22 lines, 6 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- Blammo.cabal +1/−1
- CHANGELOG.md +6/−1
- README.lhs +8/−8
- README.md +8/−8
- src/Blammo/Logging/LogSettings.hs +14/−1
- src/Blammo/Logging/LogSettings/Env.hs +3/−3
Blammo.cabal view
@@ -1,6 +1,6 @@ cabal-version: 1.18 name: Blammo-version: 2.1.0.0+version: 2.1.1.0 license: MIT license-file: LICENSE maintainer: Freckle Education
CHANGELOG.md view
@@ -1,4 +1,9 @@-## [_Unreleased_](https://github.com/freckle/blammo/compare/Blammo-v2.2.0.0...main)+## [_Unreleased_](https://github.com/freckle/blammo/compare/Blammo-v2.1.1.0...main)++## [v2.1.1.0](https://github.com/freckle/blammo/compare/v2.0.0.0...Blammo-v2.1.0.0)++- Accept special value `null` for `LOG_DESTINATION` as a synonym for the null+ device (`/dev/null` or `\\.\NUL` on windows). ## [v2.1.0.0](https://github.com/freckle/blammo/compare/v2.0.0.0...Blammo-v2.1.0.0)
README.lhs view
@@ -140,14 +140,14 @@ ## Configuration -| Setting | Setter | Environment variable and format |-| ----------- | --------------------------- | ----------------------------------------- |-| Format | `setLogSettingsFormat` | `LOG_FORMAT=tty\|json` |-| Level(s) | `setLogSettingsLevels` | `LOG_LEVEL=<level>[,<source:level>,...]` |-| Destination | `setLogSettingsDestination` | `LOG_DESTINATION=stdout\|stderr\|@<path>` |-| Color | `setLogSettingsColor ` | `LOG_COLOR=auto\|always\|never` |-| Breakpoint | `setLogSettingsBreakpoint` | `LOG_BREAKPOINT=<number>` |-| Concurrency | `setLogSettingsConcurrency` | `LOG_CONCURRENCY=<number>` |+| Setting | Setter | Environment variable and format |+| ----------- | --------------------------- | ----------------------------------------------- |+| Format | `setLogSettingsFormat` | `LOG_FORMAT=tty\|json` |+| Level(s) | `setLogSettingsLevels` | `LOG_LEVEL=<level>[,<source:level>,...]` |+| Destination | `setLogSettingsDestination` | `LOG_DESTINATION=stdout\|stderr\|null\|@<path>` |+| Color | `setLogSettingsColor ` | `LOG_COLOR=auto\|always\|never` |+| Breakpoint | `setLogSettingsBreakpoint` | `LOG_BREAKPOINT=<number>` |+| Concurrency | `setLogSettingsConcurrency` | `LOG_CONCURRENCY=<number>` | ## Advanced Usage
README.md view
@@ -140,14 +140,14 @@ ## Configuration -| Setting | Setter | Environment variable and format |-| ----------- | --------------------------- | ----------------------------------------- |-| Format | `setLogSettingsFormat` | `LOG_FORMAT=tty\|json` |-| Level(s) | `setLogSettingsLevels` | `LOG_LEVEL=<level>[,<source:level>,...]` |-| Destination | `setLogSettingsDestination` | `LOG_DESTINATION=stdout\|stderr\|@<path>` |-| Color | `setLogSettingsColor ` | `LOG_COLOR=auto\|always\|never` |-| Breakpoint | `setLogSettingsBreakpoint` | `LOG_BREAKPOINT=<number>` |-| Concurrency | `setLogSettingsConcurrency` | `LOG_CONCURRENCY=<number>` |+| Setting | Setter | Environment variable and format |+| ----------- | --------------------------- | ----------------------------------------------- |+| Format | `setLogSettingsFormat` | `LOG_FORMAT=tty\|json` |+| Level(s) | `setLogSettingsLevels` | `LOG_LEVEL=<level>[,<source:level>,...]` |+| Destination | `setLogSettingsDestination` | `LOG_DESTINATION=stdout\|stderr\|null\|@<path>` |+| Color | `setLogSettingsColor ` | `LOG_COLOR=auto\|always\|never` |+| Breakpoint | `setLogSettingsBreakpoint` | `LOG_BREAKPOINT=<number>` |+| Concurrency | `setLogSettingsConcurrency` | `LOG_CONCURRENCY=<number>` | ## Advanced Usage
src/Blammo/Logging/LogSettings.hs view
@@ -43,6 +43,7 @@ import Control.Monad.IO.Class (MonadIO (..)) import Control.Monad.Logger.Aeson import System.IO (Handle, hIsTerminalDevice)+import qualified System.Info data LogSettings = LogSettings { lsLevels :: LogLevels@@ -65,12 +66,13 @@ readLogDestination = \case "stdout" -> Right LogDestinationStdout "stderr" -> Right LogDestinationStderr+ "null" -> Right $ LogDestinationFile nullDevice ('@' : path) -> Right $ LogDestinationFile path x -> Left $ "Invalid log destination " <> x- <> ", must be stdout, stderr, or @{path}"+ <> ", must be stdout, stderr, null, or @{path}" data LogFormat = LogFormatJSON@@ -196,3 +198,14 @@ shouldColorHandle :: MonadIO m => LogSettings -> Handle -> m Bool shouldColorHandle settings h = shouldColorAuto settings $ liftIO $ hIsTerminalDevice h++-- | @/dev/null@ or @NUL@ on windows+--+-- See <https://stackoverflow.com/a/58177337>.+nullDevice :: FilePath+nullDevice+ | System.Info.os == windowsOS = "\\\\.\\NUL"+ | otherwise = "/dev/null"++windowsOS :: String+windowsOS = "mingw32"
src/Blammo/Logging/LogSettings/Env.hs view
@@ -3,9 +3,9 @@ -- - @LOG_LEVEL@: a known log level (case insensitive) and optional levels by -- source. See "Logging.LogSettings.LogLevels". ----- - @LOG_DESTINATION@: the string @stderr@ or @stdout@ (case sensitive), or--- @\@{path}@ to log to the file at @path@. Unrecognized values will produce--- and error.+-- - @LOG_DESTINATION@: the string @stderr@, @stdout@ or @null@, (case+-- sensitive), or @\@{path}@ to log to the file at @path@. Unrecognized values+-- will produce an error. -- -- - @LOG_FORMAT@: the string @tty@ or @json@. Unrecognized values will produce -- an error.