postmaster-0.1: Postmaster ESMTP ServerContentsIndex
Network.Postmaster.Syslog
PortabilityHaskell 2-pre
Stabilityprovisional
Maintainersimons@cryp.to
Contents
Marshaled Data Types
Haskell API to syslog
Helpers
Low-level C functions
Description
FFI bindings to Unix's syslog(3). Process this file with hsc2hs to obtain a Haskell module.
Synopsis
data Priority
= Emergency
| Alert
| Critical
| Error
| Warning
| Notice
| Info
| Debug
data Facility
= KERN
| USER
| MAIL
| DAEMON
| AUTH
| SYSLOG
| LPR
| NEWS
| UUCP
| CRON
| AUTHPRIV
| FTP
| LOCAL0
| LOCAL1
| LOCAL2
| LOCAL3
| LOCAL4
| LOCAL5
| LOCAL6
| LOCAL7
data Option
= PID
| CONS
| ODELAY
| NDELAY
| NOWAIT
| PERROR
withSyslog :: String -> [Option] -> Facility -> IO a -> IO a
syslog :: Priority -> String -> IO ()
useSyslog :: String -> IO a -> IO a
safeMsg :: String -> String
_closelog :: IO ()
_openlog :: CString -> CInt -> CInt -> IO ()
_setlogmask :: CInt -> IO CInt
_syslog :: CInt -> CString -> IO ()
Marshaled Data Types
data Priority
Set the priority of a message logged via syslog.
Constructors
Emergencysystem is unusable
Alertaction must be taken immediately
Criticalcritical conditions
Errorerror conditions
Warningwarning conditions
Noticenormal but significant condition
Infoinformational
Debugdebug-level messages
show/hide Instances
data Facility
Syslog knows different types of system facilities. This information is usually used to channel mesages into different log files, etc. If in doubt, USER is the best choice (and the system's default).
Constructors
KERNkernel messages
USERrandom user-level messages
MAILmail system
DAEMONsystem daemons
AUTHsecurity/authorization messages
SYSLOGmessages generated internally by syslogd
LPRline printer subsystem
NEWSnetwork news subsystem
UUCPUUCP subsystem
CRONclock daemon
AUTHPRIVsecurity/authorization messages (private)
FTPftp daemon
LOCAL0reserved for local use
LOCAL1reserved for local use
LOCAL2reserved for local use
LOCAL3reserved for local use
LOCAL4reserved for local use
LOCAL5reserved for local use
LOCAL6reserved for local use
LOCAL7reserved for local use
show/hide Instances
data Option
Options for the syslog service. Set with withSyslog.
Constructors
PIDlog the pid with each message
CONSlog on the console if errors in sending
ODELAYdelay open until first syslog() (default)
NDELAYdon't delay open
NOWAITdon't wait for console forks: DEPRECATED
PERRORlog to stderr as well
show/hide Instances
Haskell API to syslog
withSyslog :: String -> [Option] -> Facility -> IO a -> IO a

Bracket an IO computation between calls to _openlog and _closelog. Since these settings are for the process, multiple calls to this function will, unfortunately, overwrite each other.

Example:

 main = withSyslog "my-ident" [PID, PERROR] USER $ do
          putStrLn "huhu"
          syslog Debug "huhu"
syslog :: Priority -> String -> IO ()
Log a message with the given priority.
Helpers
useSyslog :: String -> IO a -> IO a
useSyslog ident = withSyslog ident [PID, PERROR] USER
safeMsg :: String -> String
Escape any occurances of '%' in a string, so that it is safe to pass it to _syslog. The syslog wrapper does this automatically.
Low-level C functions
_closelog :: IO ()
_openlog :: CString -> CInt -> CInt -> IO ()
_setlogmask :: CInt -> IO CInt
_syslog :: CInt -> CString -> IO ()
Produced by Haddock version 2.1.0