Skip to content

Commit

Permalink
Fix #43 & prepare for 1.3.1.0 release
Browse files Browse the repository at this point in the history
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
  • Loading branch information
hvriedel committed Oct 6, 2019
1 parent 8375615 commit 4c3ca34
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 8 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
12 changes: 7 additions & 5 deletions hslogger.cabal
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cabal-version: 1.12
build-type: Simple
name: hslogger
version: 1.3.0.0
version: 1.3.1.0

maintainer: [email protected]
author: John Goerzen
Expand Down Expand Up @@ -61,25 +61,27 @@ library
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
, 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
Expand Down
25 changes: 22 additions & 3 deletions src/System/Log.hs
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -25,6 +32,12 @@ module System.Log(-- * Types

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.
Expand All @@ -33,7 +46,7 @@ definitions are given below, but you are free to interpret them however you
like. They are listed here in ascending importance order.
-}

data Priority =
data Priority =
DEBUG -- ^ Debug messages
| INFO -- ^ Information
| NOTICE -- ^ Normal runtime conditions
Expand All @@ -42,9 +55,15 @@ data Priority =
| 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)

0 comments on commit 4c3ca34

Please sign in to comment.