|
| Network.Postmaster.Syslog | | Portability | Haskell 2-pre | | Stability | provisional | | Maintainer | simons@cryp.to |
|
|
|
|
|
| Description |
| FFI bindings to Unix's syslog(3). Process this file
with hsc2hs to obtain a Haskell module.
|
|
| Synopsis |
|
|
|
|
| Marshaled Data Types
|
|
| data Priority |
| Set the priority of a message logged via syslog.
| | Constructors | | Emergency | system is unusable
| | Alert | action must be taken immediately
| | Critical | critical conditions
| | Error | error conditions
| | Warning | warning conditions
| | Notice | normal but significant condition
| | Info | informational
| | Debug | debug-level messages
|
| 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 | | KERN | kernel messages
| | USER | random user-level messages
| | MAIL | mail system
| | DAEMON | system daemons
| | AUTH | security/authorization messages
| | SYSLOG | messages generated internally by syslogd
| | LPR | line printer subsystem
| | NEWS | network news subsystem
| | UUCP | UUCP subsystem
| | CRON | clock daemon
| | AUTHPRIV | security/authorization messages (private)
| | FTP | ftp daemon
| | LOCAL0 | reserved for local use
| | LOCAL1 | reserved for local use
| | LOCAL2 | reserved for local use
| | LOCAL3 | reserved for local use
| | LOCAL4 | reserved for local use
| | LOCAL5 | reserved for local use
| | LOCAL6 | reserved for local use
| | LOCAL7 | reserved for local use
|
| Instances | |
|
|
| data Option |
| Options for the syslog service. Set with withSyslog.
| | Constructors | | PID | log the pid with each message
| | CONS | log on the console if errors in sending
| | ODELAY | delay open until first syslog() (default)
| | NDELAY | don't delay open
| | NOWAIT | don't wait for console forks: DEPRECATED
| | PERROR | log to stderr as well
|
| 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 |