Maintainer | simons@cryp.to |
---|---|
Stability | provisional |
Portability | Posix |
Safe Haskell | None |
Language | Haskell98 |
FFI bindings to syslog(3) from POSIX.1-2008.
- data Priority
- toPriority :: CInt -> Priority
- fromPriority :: Priority -> CInt
- data Facility
- toFacility :: CInt -> Facility
- fromFacility :: Facility -> CInt
- data Option
- toOption :: CInt -> Option
- fromOption :: Option -> CInt
- data PriorityMask
- fromPriorityMask :: PriorityMask -> CInt
- data SyslogConfig = SyslogConfig {}
- defaultConfig :: SyslogConfig
- withSyslog :: SyslogConfig -> (SyslogFn -> IO ()) -> IO ()
- type SyslogFn = Facility -> Priority -> ByteString -> IO ()
- syslogUnsafe :: SyslogFn
- _openlog :: CString -> CInt -> CInt -> IO ()
- _closelog :: IO ()
- _setlogmask :: CInt -> IO CInt
- _syslog :: CInt -> CString -> IO ()
- _LOG_MAKEPRI :: CInt -> CInt -> CInt
- _LOG_MASK :: CInt -> CInt
- _LOG_UPTO :: CInt -> CInt
- makePri :: Facility -> Priority -> CInt
Marshaled Data Types
Log messages have a priority attached.
toPriority :: CInt -> Priority Source #
fromPriority :: Priority -> CInt Source #
Syslog distinguishes various system facilities. Most applications should
log in USER
.
KERN | kernel messages |
USER | user-level messages (default unless set otherwise) |
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 (effectively equals |
FTP | ftp daemon (effectively equals |
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 |
toFacility :: CInt -> Facility Source #
fromFacility :: Facility -> CInt Source #
withSyslog
options for the syslog service.
fromOption :: Option -> CInt Source #
data PriorityMask Source #
withSyslog
options for the priority mask.
fromPriorityMask :: PriorityMask -> CInt Source #
Configuring syslog
data SyslogConfig Source #
SyslogConfig | |
|
defaultConfig :: SyslogConfig Source #
A practical default syslog config. You'll at least want to change the identifier.
The preferred Haskell API to syslog
withSyslog :: SyslogConfig -> (SyslogFn -> IO ()) -> IO () Source #
Bracket an IO
computation between calls to _openlog
, _setlogmask
,
and _closelog
, providing a logging function which can be used as follows:
main = withSyslog defaultConfig $ \syslog -> do putStrLn "huhu" syslog USER Debug "huhu"
Note that these are process-wide settings, so multiple calls to this function will interfere with each other in unpredictable ways.
= Facility | the facility to log to |
-> Priority | the priority under which to log |
-> ByteString | the message to log |
-> IO () |
The type of function provided by withSyslog
.
The unsafe Haskell API to syslog
syslogUnsafe :: SyslogFn Source #
Provides no guarantee that a call to _openlog
has been made, inviting
unpredictable results.
Low-level C functions
See the POSIX.1-2008 documentation.
Low-level C macros
Utilities
Low-level utilities for syslog-related tools