fast-logger 2.4.13 → 2.4.14
raw patch · 3 files changed
+53/−2 lines, 3 filesdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
Files
- ChangeLog.md +4/−0
- System/Log/FastLogger/LogStr.hs +48/−1
- fast-logger.cabal +1/−1
ChangeLog.md view
@@ -1,3 +1,7 @@+## 2.4.14++* Add `ToLogStr` instances for the following types: signed integers, unsigned integers, floating-point numbers. These instances all use decimal encodings. [#177](https://github.com/kazu-yamamoto/logger/pull/177)+ ## 2.4.11 * Give an explicit definition for (<>) in LogStr's Semigroup instance. [#155](https://github.com/kazu-yamamoto/logger/pull/155)
System/Log/FastLogger/LogStr.hs view
@@ -28,6 +28,8 @@ import qualified Data.Semigroup as Semi (Semigroup(..)) #endif import Data.String (IsString(..))+import Data.Int (Int8,Int16,Int32,Int64)+import Data.Word (Word8,Word16,Word32,Word64) import qualified Data.Text as T import qualified Data.Text.Encoding as T import qualified Data.Text.Lazy as TL@@ -67,6 +69,9 @@ instance IsString LogStr where fromString = toLogStr . TL.pack +-- | Types that can be converted to a 'LogStr'. Instances for+-- types from the @text@ library use a UTF-8 encoding. Instances+-- for numerical types use a decimal encoding. class ToLogStr msg where toLogStr :: msg -> LogStr @@ -75,7 +80,7 @@ instance ToLogStr S8.ByteString where toLogStr bs = LogStr (BS.length bs) (toBuilder bs) instance ToLogStr BL.ByteString where- toLogStr = toLogStr . S8.concat . BL.toChunks+ toLogStr b = LogStr (fromIntegral (BL.length b)) (B.lazyByteString b) instance ToLogStr Builder where toLogStr x = let b = B.toLazyByteString x in LogStr (fromIntegral (BL.length b)) (B.lazyByteString b) instance ToLogStr String where@@ -84,6 +89,48 @@ toLogStr = toLogStr . T.encodeUtf8 instance ToLogStr TL.Text where toLogStr = toLogStr . TL.encodeUtf8++-- | @since 2.4.14+instance ToLogStr Int where+ toLogStr = toLogStr . B.intDec+-- | @since 2.4.14+instance ToLogStr Int8 where+ toLogStr = toLogStr . B.int8Dec+-- | @since 2.4.14+instance ToLogStr Int16 where+ toLogStr = toLogStr . B.int16Dec+-- | @since 2.4.14+instance ToLogStr Int32 where+ toLogStr = toLogStr . B.int32Dec+-- | @since 2.4.14+instance ToLogStr Int64 where+ toLogStr = toLogStr . B.int64Dec++-- | @since 2.4.14+instance ToLogStr Word where+ toLogStr = toLogStr . B.wordDec+-- | @since 2.4.14+instance ToLogStr Word8 where+ toLogStr = toLogStr . B.word8Dec+-- | @since 2.4.14+instance ToLogStr Word16 where+ toLogStr = toLogStr . B.word16Dec+-- | @since 2.4.14+instance ToLogStr Word32 where+ toLogStr = toLogStr . B.word32Dec+-- | @since 2.4.14+instance ToLogStr Word64 where+ toLogStr = toLogStr . B.word64Dec++-- | @since 2.4.14+instance ToLogStr Integer where+ toLogStr = toLogStr . B.integerDec+-- | @since 2.4.14+instance ToLogStr Float where+ toLogStr = toLogStr . B.floatDec+-- | @since 2.4.14+instance ToLogStr Double where+ toLogStr = toLogStr . B.doubleDec instance Show LogStr where show = show . T.decodeUtf8 . fromLogStr
fast-logger.cabal view
@@ -1,5 +1,5 @@ Name: fast-logger-Version: 2.4.13+Version: 2.4.14 Author: Kazu Yamamoto <kazu@iij.ad.jp> Maintainer: Kazu Yamamoto <kazu@iij.ad.jp> License: BSD3