Skip to content

Commit 4c3ca34

Browse files
committed
Fix #43 & prepare for 1.3.1.0 release
This adds `Typeable`, `Data`, `Generic` and `NFData` instances for `System.Log.Priority` and also updates the changelog & .cabal file for a 1.3.1.0 release
1 parent 8375615 commit 4c3ca34

File tree

3 files changed

+34
-8
lines changed

3 files changed

+34
-8
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
See also https://pvp.haskell.org/faq
22

3+
#### 1.3.1.0 *(minor)*
4+
5+
- Evaluate message before taking lock in simple handler ([#49](https://github.com/haskell-hvr/hslogger/pull/49))
6+
- Define `Typeable`, `Data`, `Generic` and `NFData` instances for `System.Log.Priority` ([#43](https://github.com/haskell-hvr/hslogger/pull/43))
7+
38
## 1.3.0.0 *(major)*
49

510
- **[semantic change]** Messages are encoded as UTF-8 (previously the encoding was locale dependent) for the Syslog and Growl backends

hslogger.cabal

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cabal-version: 1.12
22
build-type: Simple
33
name: hslogger
4-
version: 1.3.0.0
4+
version: 1.3.1.0
55

66
maintainer: [email protected]
77
author: John Goerzen
@@ -61,25 +61,27 @@ library
6161
UTF8
6262

6363
default-language: Haskell2010
64-
other-extensions: CPP ExistentialQuantification
64+
other-extensions: CPP ExistentialQuantification DeriveDataTypeable
6565

6666
build-depends:
67-
base >= 4.3 && < 4.13
67+
base >= 4.3 && < 4.14
6868
, bytestring >= 0.9 && < 0.11
6969
, containers >= 0.4 && < 0.7
70-
, deepseq
70+
, deepseq >= 1.1 && < 1.5
7171
, time >= 1.2 && < 1.10
7272
, old-locale >= 1.0 && < 1.1
7373

7474
if flag(network--GT-3_0_0)
7575
build-depends: network-bsd >= 2.8.1 && <2.9,
76-
network >= 3.0 && <3.1
76+
network >= 3.0 && <3.2
7777
else
7878
build-depends: network >= 2.6 && <2.9
7979

8080
if !os(windows)
8181
Build-Depends: unix >= 2.4.2 && < 2.8
8282

83+
if !impl(ghc >= 7.6)
84+
build-depends: ghc-prim
8385

8486
test-suite runtests
8587
type: exitcode-stdio-1.0

src/System/Log.hs

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
{-# LANGUAGE CPP #-}
2+
{-# LANGUAGE DeriveDataTypeable #-}
3+
4+
#if __GLASGOW_HASKELL__ >= 702
5+
{-# LANGUAGE DeriveGeneric #-}
6+
#endif
7+
18
{- |
29
Module : System.Log
310
Copyright : Copyright (C) 2004-2011 John Goerzen
@@ -25,6 +32,12 @@ module System.Log(-- * Types
2532

2633
where
2734

35+
import Control.DeepSeq (NFData(rnf))
36+
import Data.Data (Data, Typeable)
37+
#if __GLASGOW_HASKELL__ >= 702
38+
import GHC.Generics (Generic)
39+
#endif
40+
2841
{- | Priorities are used to define how important a log message is.
2942
Users can filter log messages based on priorities.
3043
@@ -33,7 +46,7 @@ definitions are given below, but you are free to interpret them however you
3346
like. They are listed here in ascending importance order.
3447
-}
3548

36-
data Priority =
49+
data Priority =
3750
DEBUG -- ^ Debug messages
3851
| INFO -- ^ Information
3952
| NOTICE -- ^ Normal runtime conditions
@@ -42,9 +55,15 @@ data Priority =
4255
| CRITICAL -- ^ Severe situations
4356
| ALERT -- ^ Take immediate action
4457
| EMERGENCY -- ^ System is unusable
45-
deriving (Eq, Ord, Enum, Bounded, Show, Read)
58+
#if __GLASGOW_HASKELL__ >= 702
59+
deriving (Eq, Ord, Enum, Bounded, Show, Read, Data, Typeable, Generic)
60+
#else
61+
deriving (Eq, Ord, Enum, Bounded, Show, Read, Data, Typeable)
62+
#endif
63+
64+
-- | @since 1.3.1.0
65+
instance NFData Priority where rnf = (`seq` ())
4666

4767
{- | Internal type of log records -}
4868

4969
type LogRecord = (Priority, String)
50-

0 commit comments

Comments
 (0)