hsyslog-1.2: FFI interface to syslog(3) from POSIX.1-2001.Source codeContentsIndex
System.Posix.Syslog
PortabilityPosix
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 Source
Log messages are prioritized.
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 Source
Syslog distinguishes various system facilities. Most applications should log in USER.
Constructors
KERNkernel messages
USERuser-level messages (default unless set otherwise)
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 Source
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 aSource

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 ()Source
Log a message with the given priority.
Helpers
useSyslog :: String -> IO a -> IO aSource
useSyslog ident = withSyslog ident [PID, PERROR] USER
safeMsg :: String -> StringSource
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 ()Source
_openlog :: CString -> CInt -> CInt -> IO ()Source
_setlogmask :: CInt -> IO CIntSource
_syslog :: CInt -> CString -> IO ()Source
Produced by Haddock version 2.1.0