packages feed

simple-log 0.9.9 → 0.9.10

raw patch · 3 files changed

+127/−127 lines, 3 filesdep ~hspecPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: hspec

API changes (from Hackage documentation)

Files

simple-log.cabal view
@@ -1,67 +1,67 @@-Name:                 simple-log-Version:              0.9.9-Synopsis:             Simple log for Haskell-Description:          Log library for Haskell-License:              BSD3-License-file:         LICENSE-Author:               Alexandr `Voidex` Ruchkin-Homepage:             http://github.com/mvoidex/simple-log-Maintainer:           voidex@live.com-Category:             Logging-Build-type:           Simple-Cabal-version:        >= 1.10--source-repository head-  type: git-  location: git://github.com/mvoidex/simple-log.git--library-  hs-source-dirs: src-  if !impl(ghc >= 8.0)-    build-depends:-      semigroups >= 0.18.2 && < 0.19-  build-depends:-    base >= 4.0 && < 6,-    async >= 2.0 && < 3.0,-    base-unicode-symbols >= 0.2 && < 0.3,-    containers >= 0.5 && < 0.7,-    data-default >= 0.5 && < 0.8,-    deepseq >= 1.4 && < 1.5,-    directory >= 1.2 && < 1.4,-    exceptions >= 0.8 && < 0.11,-    filepath >= 1.4 && < 1.5,-    hformat == 0.3.*,-    microlens == 0.4.*,-    microlens-platform == 0.3.*,-    mmorph >= 1.0 && < 1.2,-    mtl >= 2.2 && < 2.3,-    SafeSemaphore >= 0.9.0 && < 1.0.0,-    text >= 0.11.0 && < 2.0.0,-    time >= 1.5 && < 1.10,-    transformers >= 0.4 && < 0.6-  exposed-modules:-    System.Log.Simple-    System.Log.Simple.Base-    System.Log.Simple.Chan-    System.Log.Simple.Monad-    System.Log.Simple.Text-    System.Log.Simple.Stream-    System.Log.Simple.File--  default-language: Haskell2010-  default-extensions: UnicodeSyntax-  ghc-options: -Wall -fno-warn-tabs--test-suite test-  main-is: Test.hs-  hs-source-dirs: tests-  ghc-options: -threaded -Wall -fno-warn-tabs-  type: exitcode-stdio-1.0-  default-language: Haskell2010-  default-extensions: UnicodeSyntax-  build-depends:-    base >= 4.0 && < 6,-    simple-log,-    hspec >= 2.3 && < 2.6,-    microlens-platform == 0.3.*,-    text >= 0.11.0 && < 2.0.0+Name:                 simple-log
+Version:              0.9.10
+Synopsis:             Simple log for Haskell
+Description:          Log library for Haskell
+License:              BSD3
+License-file:         LICENSE
+Author:               Alexandr `Voidex` Ruchkin
+Homepage:             http://github.com/mvoidex/simple-log
+Maintainer:           voidex@live.com
+Category:             Logging
+Build-type:           Simple
+Cabal-version:        >= 1.10
+
+source-repository head
+  type: git
+  location: git://github.com/mvoidex/simple-log.git
+
+library
+  hs-source-dirs: src
+  if !impl(ghc >= 8.0)
+    build-depends:
+      semigroups >= 0.18.2 && < 0.19
+  build-depends:
+    base >= 4.0 && < 6,
+    async >= 2.0 && < 3.0,
+    base-unicode-symbols >= 0.2 && < 0.3,
+    containers >= 0.5 && < 0.7,
+    data-default >= 0.5 && < 0.8,
+    deepseq >= 1.4 && < 1.5,
+    directory >= 1.2 && < 1.4,
+    exceptions >= 0.8 && < 0.11,
+    filepath >= 1.4 && < 1.5,
+    hformat == 0.3.*,
+    microlens == 0.4.*,
+    microlens-platform == 0.3.*,
+    mmorph >= 1.0 && < 1.2,
+    mtl >= 2.2 && < 2.3,
+    SafeSemaphore >= 0.9.0 && < 1.0.0,
+    text >= 0.11.0 && < 2.0.0,
+    time >= 1.5 && < 1.10,
+    transformers >= 0.4 && < 0.6
+  exposed-modules:
+    System.Log.Simple
+    System.Log.Simple.Base
+    System.Log.Simple.Chan
+    System.Log.Simple.Monad
+    System.Log.Simple.Text
+    System.Log.Simple.Stream
+    System.Log.Simple.File
+
+  default-language: Haskell2010
+  default-extensions: UnicodeSyntax
+  ghc-options: -Wall -fno-warn-tabs
+
+test-suite test
+  main-is: Test.hs
+  hs-source-dirs: tests
+  ghc-options: -threaded -Wall -fno-warn-tabs
+  type: exitcode-stdio-1.0
+  default-language: Haskell2010
+  default-extensions: UnicodeSyntax
+  build-depends:
+    base >= 4.0 && < 6,
+    simple-log,
+    hspec >= 2.3 && < 2.7,
+    microlens-platform == 0.3.*,
+    text >= 0.11.0 && < 2.0.0
src/System/Log/Simple/Stream.hs view
@@ -1,28 +1,28 @@-module System.Log.Simple.Stream (-	stream, console,-	coloredStream, coloredConsole-	) where--import Control.Monad.IO.Class-import Data.Text (Text)-import qualified Data.Text.IO as T-import System.Log.Simple.Base-import System.IO-import Text.Format (Formatted)-import Text.Format.Colored--stream ∷ Handle → Consumer Text-stream h = do-	liftIO $ hSetEncoding h utf8-	return $ \txt → T.hPutStrLn h txt >> hFlush h--console ∷ Consumer Text-console = stream stderr--coloredStream ∷ Handle → Consumer Formatted-coloredStream h = do-	liftIO $ hSetEncoding h utf8-	return $ \f → hColoredLine h f >> hFlush h--coloredConsole ∷ Consumer Formatted-coloredConsole = coloredStream stderr+module System.Log.Simple.Stream (
+	stream, console,
+	coloredStream, coloredConsole
+	) where
+
+import Control.Monad.IO.Class
+import Data.Text (Text)
+import qualified Data.Text.IO as T
+import System.Log.Simple.Base
+import System.IO
+import Text.Format (Formatted)
+import Text.Format.Colored
+
+stream ∷ Handle → Consumer Text
+stream h = do
+	liftIO $ hSetEncoding h utf8
+	return $ \txt → T.hPutStrLn h txt >> hFlush h
+
+console ∷ Consumer Text
+console = stream stderr
+
+coloredStream ∷ Handle → Consumer Formatted
+coloredStream h = do
+	liftIO $ hSetEncoding h utf8
+	return $ \f → hColoredLine h f >> hFlush h
+
+coloredConsole ∷ Consumer Formatted
+coloredConsole = coloredStream stderr
src/System/Log/Simple/Text.hs view
@@ -1,32 +1,32 @@-module System.Log.Simple.Text (-	defaultTimeFormat,-	textFmt, text, shortText, msgOnly-	) where--import Data.Time-import Text.Format--import System.Log.Simple.Base---- | Default time format-defaultTimeFormat ∷ String-defaultTimeFormat = "%_Y-%m-%d %T.%3q %z"--textFmt ∷ FormatResult r ⇒ String → String → Converter r-textFmt tmFmt msgFmt (Message tm l comp scope msg) = format msgFmt ~~ args where-	args = [-		"time" ~% formatTime defaultTimeLocale tmFmt tm,-		"level" ~% l,-		"component" ~% comp,-		"scope" ~% scope,-		"message" ~% msg]---- | Text log converter with default time format-text ∷ FormatResult r ⇒ Converter r-text = textFmt defaultTimeFormat "{time:cyan}\t{level}\t{component:magenta}:{scope:green}> {message}"--shortText ∷ FormatResult r ⇒ Converter r-shortText = textFmt defaultTimeFormat "{level}\t{component:magenta}: {message}"--msgOnly ∷ FormatResult r ⇒ Converter r-msgOnly = textFmt defaultTimeFormat "{message}"+module System.Log.Simple.Text (
+	defaultTimeFormat,
+	textFmt, text, shortText, msgOnly
+	) where
+
+import Data.Time
+import Text.Format
+
+import System.Log.Simple.Base
+
+-- | Default time format
+defaultTimeFormat ∷ String
+defaultTimeFormat = "%_Y-%m-%d %T.%3q %z"
+
+textFmt ∷ FormatResult r ⇒ String → String → Converter r
+textFmt tmFmt msgFmt (Message tm l comp scope msg) = format msgFmt ~~ args where
+	args = [
+		"time" ~% formatTime defaultTimeLocale tmFmt tm,
+		"level" ~% l,
+		"component" ~% comp,
+		"scope" ~% scope,
+		"message" ~% msg]
+
+-- | Text log converter with default time format
+text ∷ FormatResult r ⇒ Converter r
+text = textFmt defaultTimeFormat "{time:cyan}\t{level}\t{component:magenta}:{scope:green}> {message}"
+
+shortText ∷ FormatResult r ⇒ Converter r
+shortText = textFmt defaultTimeFormat "{level}\t{component:magenta}: {message}"
+
+msgOnly ∷ FormatResult r ⇒ Converter r
+msgOnly = textFmt defaultTimeFormat "{message}"