[Pkg-haskell-commits] [SCM] haskell-testpack branch, master, updated. debian/1.0.2-1-4-gb0d6b36
John Goerzen
jgoerzen at complete.org
Fri Apr 23 14:43:54 UTC 2010
The following commit has been merged in the master branch:
commit 634f29eed76fd26d5c0cd4cf7dcdf2b00df7c0ef
Author: John Goerzen <jgoerzen at complete.org>
Date: Fri Oct 8 03:24:05 2004 +0100
Fixed handling of PID in syslog
Keywords:
(jgoerzen at complete.org--projects/missingh--head--1.0--patch-47)
diff --git a/ChangeLog b/ChangeLog
index 995290c..dcb14d1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,18 @@
# arch-tag: automatic-ChangeLog--jgoerzen at complete.org--projects/missingh--head--1.0
#
+2004-10-07 21:24:05 GMT John Goerzen <jgoerzen at complete.org> patch-47
+
+ Summary:
+ Fixed handling of PID in syslog
+ Revision:
+ missingh--head--1.0--patch-47
+
+
+ modified files:
+ ChangeLog libsrc/MissingH/Logging/Handler/Syslog.hs
+
+
2004-10-07 21:17:37 GMT John Goerzen <jgoerzen at complete.org> patch-46
Summary:
diff --git a/libsrc/MissingH/Logging/Handler/Syslog.hs b/libsrc/MissingH/Logging/Handler/Syslog.hs
index 44eec95..6e4a1c6 100644
--- a/libsrc/MissingH/Logging/Handler/Syslog.hs
+++ b/libsrc/MissingH/Logging/Handler/Syslog.hs
@@ -36,6 +36,7 @@ import Data.Bits
import Network.Socket
import Network.BSD
import List
+import System.Posix.Process(getProcessID)
code_of_pri :: Priority -> Int
code_of_pri p = case p of
@@ -105,6 +106,7 @@ makeCode fac pri =
data Option = PID -- ^ Automatically log process ID (PID) with each message
| PERROR -- ^ Send a copy of each message to stderr
+ deriving (Eq,Show,Read)
data SyslogHandler = SyslogHandler {options :: [Option],
facility :: Facility,
@@ -150,7 +152,13 @@ instance LogHandler SyslogHandler where
getLevel sh = priority sh
emit sh (p, msg) =
let code = makeCode (facility sh) p
- outstr = "<" ++ (show code) ++ ">" ++ msg ++ "\0"
+ getpid :: IO String
+ getpid = if (elem PID (options sh))
+ then do
+ pid <- getProcessID
+ return ("[" ++ show pid ++ "]")
+ else return ""
+
sendstr :: String -> IO String
sendstr [] = return []
sendstr omsg = do
@@ -158,6 +166,9 @@ instance LogHandler SyslogHandler where
sendstr (genericDrop sent omsg)
in
do
+ pidstr <- getpid
+ let outstr = "<" ++ (show code) ++ ">"
+ ++ (identity sh) ++ pidstr ++ ": " ++ msg ++ "\0"
sendstr outstr
return ()
close sh = sClose (logsocket sh)
--
haskell-testpack
More information about the Pkg-haskell-commits
mailing list