packages feed

tinylog 0.12.1 → 0.13.0

raw patch · 4 files changed

+47/−37 lines, 4 filesdep −auto-updatedep ~basedep ~bytestringdep ~double-conversion

Dependencies removed: auto-update

Dependency ranges changed: base, bytestring, double-conversion, fast-logger, text, transformers, unix-time

Files

CHANGELOG.md view
@@ -1,3 +1,8 @@+0.13.0+-----------------------------------------------------------------------------+- Change `DateFormat` representation to `UnixTime -> ByteString`. This+  is mainly to allow clients complete control over date and time formatting.+ 0.12.1 ----------------------------------------------------------------------------- - Relax upper-bound of `fast-logger` dependency.
src/System/Logger.hs view
@@ -32,7 +32,7 @@     , Logger     , Level      (..)     , Output     (..)-    , DateFormat+    , DateFormat (..)     , iso8601UTC        -- * Core API@@ -56,9 +56,7 @@     , module M     ) where -import Prelude hiding (log) import Control.Applicative-import Control.AutoUpdate import Control.Monad import Control.Monad.IO.Class import Data.Maybe (fromMaybe)@@ -67,6 +65,7 @@ import System.Environment (lookupEnv) import System.Logger.Message as M import System.Logger.Settings+import Prelude hiding (log)  import qualified Data.Map.Strict       as Map import qualified System.Log.FastLogger as FL@@ -120,9 +119,8 @@     fn StdErr   = FL.newStderrLoggerSet     fn (Path p) = flip FL.newFileLoggerSet p -    mkGetDate "" = return (return id)-    mkGetDate f  = mkAutoUpdate defaultUpdateSettings-        { updateAction = msg . formatUnixTimeGMT (template f) <$> getUnixTime }+    mkGetDate Nothing  = return (return id)+    mkGetDate (Just f) = return (msg . (display f) <$> getUnixTime)      mergeWith m e = Map.fromList (readNote "Invalid LOG_LEVEL_MAP" e) `Map.union` m 
src/System/Logger/Settings.hs view
@@ -38,18 +38,19 @@ import Data.ByteString.Char8 (pack) import Data.Map.Strict as Map import Data.Text (Text)+import Data.UnixTime import System.Log.FastLogger (defaultBufSize) import System.Logger.Message  data Settings = Settings-    { _logLevel   :: !Level            -- ^ messages below this log level will be suppressed-    , _levelMap   :: !(Map Text Level) -- ^ log level per named logger-    , _output     :: !Output           -- ^ log sink-    , _format     :: !DateFormat       -- ^ the timestamp format (use \"\" to disable timestamps)-    , _delimiter  :: !ByteString       -- ^ text to intersperse between fields of a log line-    , _netstrings :: !Bool             -- ^ use <http://cr.yp.to/proto/netstrings.txt netstrings> encoding (fixes delimiter to \",\")-    , _bufSize    :: !Int              -- ^ how many bytes to buffer before commiting to sink-    , _name       :: !(Maybe Text)     -- ^ logger name+    { _logLevel   :: !Level              -- ^ messages below this log level will be suppressed+    , _levelMap   :: !(Map Text Level)   -- ^ log level per named logger+    , _output     :: !Output             -- ^ log sink+    , _format     :: !(Maybe DateFormat) -- ^ the timestamp format+    , _delimiter  :: !ByteString         -- ^ text to intersperse between fields of a log line+    , _netstrings :: !Bool               -- ^ use <http://cr.yp.to/proto/netstrings.txt netstrings> encoding (fixes delimiter to \",\")+    , _bufSize    :: !Int                -- ^ how many bytes to buffer before commiting to sink+    , _name       :: !(Maybe Text)       -- ^ logger name     , _nameMsg    :: !(Msg -> Msg)     } @@ -60,11 +61,11 @@ setOutput x s = s { _output = x }  -- | The time and date format used for the timestamp part of a log line.-format :: Settings -> DateFormat+format :: Settings -> Maybe DateFormat format = _format  setFormat :: DateFormat -> Settings -> Settings-setFormat x s = s { _format = x }+setFormat x s = s { _format = Just x }  bufSize :: Settings -> Int bufSize = _bufSize@@ -135,11 +136,11 @@     deriving (Eq, Ord, Show)  newtype DateFormat = DateFormat-    { template :: ByteString-    } deriving (Eq, Ord, Show)+    { display :: UnixTime -> ByteString+    }  instance IsString DateFormat where-    fromString = DateFormat . pack+    fromString = DateFormat . formatUnixTimeGMT . pack  -- | ISO 8601 date-time format. iso8601UTC :: DateFormat@@ -162,5 +163,13 @@ --   * 'name'       = Nothing -- defSettings :: Settings-defSettings = Settings Debug Map.empty StdOut iso8601UTC ", " False defaultBufSize Nothing id-+defSettings = Settings+    Debug+    Map.empty+    StdOut+    (Just iso8601UTC)+    ", "+    False+    defaultBufSize+    Nothing+    id
tinylog.cabal view
@@ -1,12 +1,12 @@ name:                 tinylog-version:              0.12.1+version:              0.13.0 synopsis:             Simplistic logging using fast-logger. author:               Toralf Wittner maintainer:           Toralf Wittner <tw@dtex.org>-copyright:            (c) 2014 Toralf Wittner-homepage:             https://github.com/twittner/tinylog/-bug-reports:          https://github.com/twittner/tinylog/issues-license:              OtherLicense+copyright:            (C) 2014 Toralf Wittner+homepage:             https://gitlab.com/twittner/tinylog/+bug-reports:          https://gitlab.com/twittner/tinylog/issues+license:              MPL-2.0 license-file:         LICENSE category:             System build-type:           Simple@@ -18,13 +18,12 @@  source-repository head     type:             git-    location:         git://github.com/twittner/tinylog.git+    location:         git://gitlab.com/twittner/tinylog.git  library     default-language: Haskell2010     hs-source-dirs:   src     ghc-options:      -Wall -O2 -fwarn-tabs-    ghc-prof-options: -prof -auto-all      exposed-modules:         System.Logger@@ -35,15 +34,14 @@         System.Logger.Settings      build-depends:-          base              == 4.*-        , bytestring        >= 0.10.4 && < 1.0-        , auto-update       >= 0.1    && < 0.2+          base              >= 4.6    && < 5+        , bytestring        >= 0.10.4         , containers        >= 0.5-        , double-conversion >= 0.2    && < 3.0-        , fast-logger       >= 2.1.4  && < 3.0-        , text              >= 0.11   && < 2.0-        , transformers      >= 0.3    && < 1.0-        , unix-time         >= 0.1    && < 0.4+        , double-conversion >= 0.2+        , fast-logger       >= 2.1.4+        , text              >= 0.11+        , transformers      >= 0.3+        , unix-time         >= 0.1  benchmark tinylog-bench     type:             exitcode-stdio-1.0@@ -52,7 +50,7 @@     hs-source-dirs:   bench     ghc-options:      -Wall -O2 -fwarn-tabs     build-depends:-          base       == 4.*+          base         , bytestring         , criterion  >= 1.0.0.2         , tinylog