hsyslog 5.0.1 → 5.0.2
raw patch · 7 files changed
+23/−73 lines, 7 filesdep −doctestdep ~basesetup-changedPVP ok
version bump matches the API change (PVP)
Dependencies removed: doctest
Dependency ranges changed: base
API changes (from Hackage documentation)
Files
- Setup.hs +1/−29
- c-bits/simple-syslog.c +13/−13
- hsyslog.cabal +4/−16
- src/System/Posix/Syslog.hs +2/−2
- src/System/Posix/Syslog/LogMask.hs +1/−1
- src/System/Posix/Syslog/Options.hsc +2/−2
- test/doctests.hs +0/−10
Setup.hs view
@@ -1,34 +1,6 @@-{-# LANGUAGE CPP #-}-{-# OPTIONS_GHC -Wall #-}--module Main ( main ) where--#ifndef MIN_VERSION_cabal_doctest-#define MIN_VERSION_cabal_doctest(x,y,z) 0-#endif--#if MIN_VERSION_cabal_doctest(1,0,0)--import Distribution.Extra.Doctest ( defaultMainWithDoctests )-main :: IO ()-main = defaultMainWithDoctests "doctests"--#else--#ifdef MIN_VERSION_Cabal--- If the macro is defined, we have new cabal-install,--- but for some reason we don't have cabal-doctest in package-db------ Probably we are running cabal sdist, when otherwise using new-build--- workflow-#warning You are configuring this package without cabal-doctest installed. \- The doctests test-suite will not work as a result. \- To fix this, install cabal-doctest before configuring.-#endif+module Main (main) where import Distribution.Simple main :: IO () main = defaultMain--#endif
c-bits/simple-syslog.c view
@@ -1,24 +1,24 @@ #include <syslog.h> /*- A variant of syslog(3) that provides a simplified API to addresses the+ A variant of syslog(3) that provides a simplified API to address the following issues: - - Calling variadic functions via FFI kind-of sort-of works, but the Haskell- standard actually doesn't guarantee it. There is a GHC extension, CApiFFI,- which addresses this issue, but then that extension isn't part of any+ - Calling variadic functions via FFI kind-of "just works", but the Haskell+ standard actually doesn't guarantee that it does. There's a GHC extension,+ CApiFFI, which addresses this issue, but that extension isn't part of any Haskell standard either. - - Strings in Haskell are almost never terminated by a \0 byte. We generally- do know their lengths, though, so it's more convenient to specify an- explicit maximum field length in the format string via "%.*s" and pass our- string as an argument to that. An added benefit is that our syslog- function doesn't interpret any of those freaky % formatting features that- can't support (and don't want to, really).+ - Strings in Haskell are almost never terminated by a \0 byte, but we tend+ to know their length, so it's more convenient (and more efficient) to+ specify an explicit maximum field length in the format string via "%.*s"+ and pass our string as an argument to that. A welcome side-effect of this+ approach is that the call won't try to interpret any of those freaky %+ formatting features that we can't support (and don't want to, really). - Note that we totally don't make any effort whatsoever to guarantee- meaningful argument values. If you wan to pass a negative string length,- null pointers and non-existent facility values ... be our guest!+ Note that this function makes no effort to verify the validity of its+ arguments. If you want to pass a negative string length, null pointers, and+ non-existent facilities here ... have at it and see what happens! */ void simpleSyslog(int facility, int priority, const char * buf, int len)
hsyslog.cabal view
@@ -1,7 +1,7 @@ name: hsyslog-version: 5.0.1+version: 5.0.2 cabal-version: >= 1.10-build-type: Custom+build-type: Simple license: BSD3 license-file: LICENSE copyright: Copyright (c) 2004-2017 by Peter Simons@@ -11,7 +11,8 @@ bug-reports: http://github.com/peti/hsyslog/issues synopsis: FFI interface to syslog(3) from POSIX.1-2001 category: Foreign-tested-with: GHC > 7.6 && < 8.3+tested-with: GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.2+ , GHC == 8.2.2, GHC == 8.4.4, GHC == 8.6.3 extra-source-files: c-bits/simple-syslog.c@@ -29,11 +30,6 @@ <https://github.com/peti/hsyslog/blob/master/example/Main.hs examples> directory of this package. -custom-setup- setup-depends: base >= 4 && <5,- Cabal,- cabal-doctest >= 1 && <1.1- source-repository head type: git location: git://github.com/peti/hsyslog.git@@ -56,14 +52,6 @@ c-bits/make-log-mask.c default-language: Haskell2010 build-tools: hsc2hs--test-suite doctests- type: exitcode-stdio-1.0- main-is: doctests.hs- hs-source-dirs: test- build-depends: hsyslog, base, doctest- ghc-options: -threaded- default-language: Haskell2010 executable hsyslog-example main-is: Main.hs
src/System/Posix/Syslog.hs view
@@ -62,7 +62,7 @@ -- /does/ contain a @\\0@ byte, then the message ends -- there regardless of what the length argument says. -> IO ()-syslog facil prio (ptr,len) = assert (len >= 0) $ do+syslog facil prio (ptr,len) = assert (len >= 0) $ _syslog (maybe 0 fromFacility facil) (fromPriority prio) ptr (fromIntegral len) -- | This function configures the process-wide hidden state of the system's@@ -72,7 +72,7 @@ -- properly initialized within its scope. openlog :: CString -- ^ An identifier to prepend to all log messages,- -- typically the name of the programm. Note that the+ -- typically the name of the program. Note that the -- memory that contains this name must remain valid -- until the pointer provided here is released by -- calling 'closelog'.
src/System/Posix/Syslog/LogMask.hs view
@@ -22,7 +22,7 @@ -- representation suitable for calling '_setlogmask'. toLogMask :: [Priority] -> CInt-toLogMask = foldr (.|.) 0 . map (_logMask . fromPriority)+toLogMask = foldr ((.|.) . _logMask . fromPriority) 0 -- | Decode the the system-dependent binary representation returned by -- '_setlogmask' back into a set of logging priorities.
src/System/Posix/Syslog/Options.hsc view
@@ -20,13 +20,13 @@ #include <syslog.h> -- | The function 'openlog' allows one to configure a handful of process-wide--- options that modify the bahavior of the 'syslog' funcion. These options are+-- options that modify the behavior of the 'syslog' function. These options are -- 'pid', 'cons', 'odelay', and 'ndelay'. data Option = LogPID -- ^ Log the pid with each message. | Console -- ^ Log on the console if errors occur while sending messages. | DelayedOpen -- ^ Delay all initialization until first @syslog()@ call (default).- | ImmediateOpen -- ^ Initalize the syslog system immediately.+ | ImmediateOpen -- ^ Initialize the syslog system immediately. | DontWaitForChildren -- ^ The syslog system should not attempt to wait for child -- process it may have created. This option is required by -- applications who enable @SIGCHLD@ themselves.
− test/doctests.hs
@@ -1,10 +0,0 @@-module Main where--import Build_doctests (flags, pkgs, module_sources)-import Data.Foldable (traverse_)-import Test.DocTest (doctest)--main :: IO ()-main = do let args = flags ++ pkgs ++ module_sources- traverse_ putStrLn args -- optionally print arguments- doctest args