Hello community,

here is the log from the commit of package ghc-fast-logger for openSUSE:Factory 
checked in at 2018-05-30 12:07:18
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-fast-logger (Old)
 and      /work/SRC/openSUSE:Factory/.ghc-fast-logger.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc-fast-logger"

Wed May 30 12:07:18 2018 rev:11 rq:607796 version:2.4.11

Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-fast-logger/ghc-fast-logger.changes  
2017-09-15 21:39:13.043842745 +0200
+++ /work/SRC/openSUSE:Factory/.ghc-fast-logger.new/ghc-fast-logger.changes     
2018-05-30 12:25:39.813622554 +0200
@@ -1,0 +2,7 @@
+Mon May 14 17:02:11 UTC 2018 - [email protected]
+
+- Update fast-logger to version 2.4.11.
+  * Give an explicit definition for (<>) in LogStr's Semigroup instance.
+    [#155](https://github.com/kazu-yamamoto/logger/pull/155)
+
+-------------------------------------------------------------------

Old:
----
  fast-logger-2.4.10.tar.gz

New:
----
  fast-logger-2.4.11.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ ghc-fast-logger.spec ++++++
--- /var/tmp/diff_new_pack.6FePXI/_old  2018-05-30 12:25:40.629595537 +0200
+++ /var/tmp/diff_new_pack.6FePXI/_new  2018-05-30 12:25:40.633595406 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package ghc-fast-logger
 #
-# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -19,7 +19,7 @@
 %global pkg_name fast-logger
 %bcond_with tests
 Name:           ghc-%{pkg_name}
-Version:        2.4.10
+Version:        2.4.11
 Release:        0
 Summary:        A fast logging system
 License:        BSD-3-Clause
@@ -74,7 +74,7 @@
 %ghc_pkg_recache
 
 %files -f %{name}.files
-%doc LICENSE
+%license LICENSE
 
 %files devel -f %{name}-devel.files
 %doc ChangeLog.md README.md

++++++ fast-logger-2.4.10.tar.gz -> fast-logger-2.4.11.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fast-logger-2.4.10/ChangeLog.md 
new/fast-logger-2.4.11/ChangeLog.md
--- old/fast-logger-2.4.10/ChangeLog.md 2017-01-31 06:26:03.000000000 +0100
+++ new/fast-logger-2.4.11/ChangeLog.md 2018-02-05 03:01:32.000000000 +0100
@@ -1,3 +1,7 @@
+## 2.4.11
+
+* Give an explicit definition for (<>) in LogStr's Semigroup instance. 
[#155](https://github.com/kazu-yamamoto/logger/pull/155)
+
 ## 2.4.10
 
 * Fix Windows build on GHC 7.8. 
[#121](https://github.com/kazu-yamamoto/logger/pull/121)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fast-logger-2.4.10/System/Log/FastLogger/LogStr.hs 
new/fast-logger-2.4.11/System/Log/FastLogger/LogStr.hs
--- old/fast-logger-2.4.10/System/Log/FastLogger/LogStr.hs      2017-01-31 
06:26:03.000000000 +0100
+++ new/fast-logger-2.4.11/System/Log/FastLogger/LogStr.hs      2018-02-05 
03:01:32.000000000 +0100
@@ -25,7 +25,7 @@
 import Data.Monoid ((<>))
 #endif
 #if MIN_VERSION_base(4,9,0)
-import Data.Semigroup (Semigroup)
+import qualified Data.Semigroup as Semi (Semigroup(..))
 #endif
 import Data.String (IsString(..))
 import qualified Data.Text as T
@@ -56,7 +56,8 @@
 data LogStr = LogStr !Int Builder
 
 #if MIN_VERSION_base(4,9,0)
-instance Semigroup LogStr
+instance Semi.Semigroup LogStr where
+    LogStr s1 b1 <> LogStr s2 b2 = LogStr (s1 + s2) (b1 <> b2)
 #endif
 
 instance Monoid LogStr where
@@ -82,6 +83,12 @@
 instance ToLogStr TL.Text where
     toLogStr = toLogStr . TL.encodeUtf8
 
+instance Show LogStr where
+  show = show . T.decodeUtf8 . fromLogStr
+
+instance Eq LogStr where
+  a == b = fromLogStr a == fromLogStr b
+
 -- | Obtaining the length of 'LogStr'.
 logStrLength :: LogStr -> Int
 logStrLength (LogStr n _) = n
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fast-logger-2.4.10/System/Log/FastLogger.hs 
new/fast-logger-2.4.11/System/Log/FastLogger.hs
--- old/fast-logger-2.4.10/System/Log/FastLogger.hs     2017-01-31 
06:26:03.000000000 +0100
+++ new/fast-logger-2.4.11/System/Log/FastLogger.hs     2018-02-05 
03:01:32.000000000 +0100
@@ -182,7 +182,8 @@
     = LogNone                     -- ^ No logging.
     | LogStdout BufSize           -- ^ Logging to stdout.
                                   --   'BufSize' is a buffer size
-    | LogStderr BufSize           -- ^ Logging to stdout.
+                                  --   for each capability.
+    | LogStderr BufSize           -- ^ Logging to stderr.
                                   --   'BufSize' is a buffer size
                                   --   for each capability.
     | LogFileNoRotate FilePath BufSize
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fast-logger-2.4.10/fast-logger.cabal 
new/fast-logger-2.4.11/fast-logger.cabal
--- old/fast-logger-2.4.10/fast-logger.cabal    2017-01-31 06:26:03.000000000 
+0100
+++ new/fast-logger-2.4.11/fast-logger.cabal    2018-02-05 03:01:32.000000000 
+0100
@@ -1,5 +1,5 @@
 Name:                   fast-logger
-Version:                2.4.10
+Version:                2.4.11
 Author:                 Kazu Yamamoto <[email protected]>
 Maintainer:             Kazu Yamamoto <[email protected]>
 License:                BSD3
@@ -47,6 +47,7 @@
     Type:            exitcode-stdio-1.0
 
     Ghc-Options:     -Wall -threaded
+    Other-Modules:   FastLoggerSpec
     Build-Depends:   base >= 4 && < 5
                    , bytestring
                    , directory
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fast-logger-2.4.10/test/FastLoggerSpec.hs 
new/fast-logger-2.4.11/test/FastLoggerSpec.hs
--- old/fast-logger-2.4.10/test/FastLoggerSpec.hs       1970-01-01 
01:00:00.000000000 +0100
+++ new/fast-logger-2.4.11/test/FastLoggerSpec.hs       2018-02-05 
03:01:32.000000000 +0100
@@ -0,0 +1,83 @@
+{-# LANGUAGE OverloadedStrings, BangPatterns, CPP #-}
+
+module FastLoggerSpec where
+
+#if __GLASGOW_HASKELL__ < 709
+import Control.Applicative ((<$>))
+#endif
+import Control.Exception (finally)
+import Control.Monad (when)
+import qualified Data.ByteString.Char8 as BS
+import Data.Monoid ((<>))
+import Data.String (IsString(fromString))
+import System.Directory (doesFileExist, removeFile)
+import System.Log.FastLogger
+import Test.Hspec
+import Test.Hspec.QuickCheck (prop)
+
+spec :: Spec
+spec = do
+  describe "instance Show LogStr" $ do
+    prop "it should be consistent with instance IsString" $ \str ->
+      let logstr :: LogStr
+          logstr = fromString str
+      in show logstr == show str
+  describe "instance Eq LogStr" $ do
+    prop "it should be consistent with instance IsString" $ \str1 str2 ->
+      let logstr1, logstr2 :: LogStr
+          logstr1 = fromString str1
+          logstr2 = fromString str2
+      in (logstr1 == logstr2) == (str1 == str2)
+  describe "pushLogMsg" $ do
+    it "is safe for a large message" $ safeForLarge [
+        100
+      , 1000
+      , 10000
+      , 100000
+      , 1000000
+      ]
+    it "logs all messages" logAllMsgs
+
+nullLogger :: IO LoggerSet
+#ifdef mingw32_HOST_OS
+nullLogger = newFileLoggerSet 4096 "nul"
+#else
+nullLogger = newFileLoggerSet 4096 "/dev/null"
+#endif
+
+safeForLarge :: [Int] -> IO ()
+safeForLarge ns = mapM_ safeForLarge' ns
+
+safeForLarge' :: Int -> IO ()
+safeForLarge' n = flip finally (cleanup tmpfile) $ do
+    cleanup tmpfile
+    lgrset <- newFileLoggerSet defaultBufSize tmpfile
+    let xs = toLogStr $ BS.pack $ take (abs n) (cycle ['a'..'z'])
+        lf = "x"
+    pushLogStr lgrset $ xs <> lf
+    flushLogStr lgrset
+    rmLoggerSet lgrset
+    bs <- BS.readFile tmpfile
+    bs `shouldBe` BS.pack (take (abs n) (cycle ['a'..'z']) <> "x")
+    where
+        tmpfile = "test/temp"
+
+cleanup :: FilePath -> IO ()
+cleanup file = do
+    exist <- doesFileExist file
+    when exist $ removeFile file
+
+logAllMsgs :: IO ()
+logAllMsgs = logAll "LICENSE" `finally` cleanup tmpfile
+  where
+    tmpfile = "test/temp"
+    logAll file = do
+        cleanup tmpfile
+        lgrset <- newFileLoggerSet 512 tmpfile
+        src <- BS.readFile file
+        let bs = (<> "\n") . toLogStr <$> BS.lines src
+        mapM_ (pushLogStr lgrset) bs
+        flushLogStr lgrset
+        rmLoggerSet lgrset
+        dst <- BS.readFile tmpfile
+        dst `shouldBe` src


Reply via email to