hslogger 1.3.0.0 → 1.3.1.0
raw patch · 4 files changed
+36/−7 lines, 4 filesdep +deepseqdep +ghc-primdep ~basedep ~bytestringdep ~containersPVP ok
version bump matches the API change (PVP)
Dependencies added: deepseq, ghc-prim
Dependency ranges changed: base, bytestring, containers, network, time, unix
API changes (from Hackage documentation)
+ System.Log: instance Control.DeepSeq.NFData System.Log.Priority
+ System.Log: instance Data.Data.Data System.Log.Priority
+ System.Log: instance GHC.Generics.Generic System.Log.Priority
Files
- CHANGELOG.md +5/−0
- hslogger.cabal +7/−4
- src/System/Log.hs +22/−3
- src/System/Log/Handler/Simple.hs +2/−0
CHANGELOG.md view
@@ -1,5 +1,10 @@ See also https://pvp.haskell.org/faq +#### 1.3.1.0 *(minor)*++- Evaluate message before taking lock in simple handler ([#49](https://github.com/haskell-hvr/hslogger/pull/49))+- Define `Typeable`, `Data`, `Generic` and `NFData` instances for `System.Log.Priority` ([#43](https://github.com/haskell-hvr/hslogger/pull/43))+ ## 1.3.0.0 *(major)* - **[semantic change]** Messages are encoded as UTF-8 (previously the encoding was locale dependent) for the Syslog and Growl backends
hslogger.cabal view
@@ -1,7 +1,7 @@ cabal-version: 1.12 build-type: Simple name: hslogger-version: 1.3.0.0+version: 1.3.1.0 maintainer: hvr@gnu.org author: John Goerzen@@ -61,24 +61,27 @@ UTF8 default-language: Haskell2010- other-extensions: CPP ExistentialQuantification+ other-extensions: CPP ExistentialQuantification DeriveDataTypeable build-depends:- base >= 4.3 && < 4.13+ base >= 4.3 && < 4.14 , bytestring >= 0.9 && < 0.11 , containers >= 0.4 && < 0.7+ , deepseq >= 1.1 && < 1.5 , time >= 1.2 && < 1.10 , old-locale >= 1.0 && < 1.1 if flag(network--GT-3_0_0) build-depends: network-bsd >= 2.8.1 && <2.9,- network >= 3.0 && <3.1+ network >= 3.0 && <3.2 else build-depends: network >= 2.6 && <2.9 if !os(windows) Build-Depends: unix >= 2.4.2 && < 2.8 + if !impl(ghc >= 7.6)+ build-depends: ghc-prim test-suite runtests type: exitcode-stdio-1.0
src/System/Log.hs view
@@ -1,3 +1,10 @@+{-# LANGUAGE CPP #-}+{-# LANGUAGE DeriveDataTypeable #-}++#if __GLASGOW_HASKELL__ >= 702+{-# LANGUAGE DeriveGeneric #-}+#endif+ {- | Module : System.Log Copyright : Copyright (C) 2004-2011 John Goerzen@@ -25,6 +32,12 @@ where +import Control.DeepSeq (NFData(rnf))+import Data.Data (Data, Typeable)+#if __GLASGOW_HASKELL__ >= 702+import GHC.Generics (Generic)+#endif+ {- | Priorities are used to define how important a log message is. Users can filter log messages based on priorities. @@ -33,7 +46,7 @@ like. They are listed here in ascending importance order. -} -data Priority = +data Priority = DEBUG -- ^ Debug messages | INFO -- ^ Information | NOTICE -- ^ Normal runtime conditions@@ -42,9 +55,15 @@ | CRITICAL -- ^ Severe situations | ALERT -- ^ Take immediate action | EMERGENCY -- ^ System is unusable- deriving (Eq, Ord, Enum, Bounded, Show, Read)+#if __GLASGOW_HASKELL__ >= 702+ deriving (Eq, Ord, Enum, Bounded, Show, Read, Data, Typeable, Generic)+#else+ deriving (Eq, Ord, Enum, Bounded, Show, Read, Data, Typeable)+#endif +-- | @since 1.3.1.0+instance NFData Priority where rnf = (`seq` ())+ {- | Internal type of log records -} type LogRecord = (Priority, String)-
src/System/Log/Handler/Simple.hs view
@@ -16,6 +16,7 @@ where import Control.Exception (tryJust)+import Control.DeepSeq import Data.Char (ord) import System.Log@@ -51,6 +52,7 @@ streamHandler h pri = do lock <- newMVar () let mywritefunc hdl msg =+ msg `deepseq` withMVar lock (\_ -> do writeToHandle hdl msg hFlush hdl )