-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | FFI interface to syslog(3) from POSIX.1-2001 -- -- A Haskell interface to syslog(3) as specified in -- POSIX.1-2008. The entire public API lives in -- System.Posix.Syslog. There is a set of exposed modules -- available underneath that one, which contain various implementation -- details that may be useful to other developers who want to implement -- syslog-related functionality. Users of syslog, -- however, do not need them. -- -- An example program that demonstrates how to use this library is -- available in the examples directory of this package. @package hsyslog @version 5 -- | FFI bindings to syslog(3) from POSIX.1-2008. This -- module is intended for purposes of low-level implementation. Users of -- this library should prefer safer and more convenient API provided by -- System.Posix.Syslog. module System.Posix.Syslog.Priority -- | Log messages are prioritized with one of the following levels: -- --
--   >>> [minBound..maxBound] :: [Priority]
--   [Emergency,Alert,Critical,Error,Warning,Notice,Info,Debug]
--   
-- -- The Ord instance for Priority considers the more urgent -- level lower than less urgent ones: -- --
--   >>> Emergency < Debug
--   True
--   
--   >>> minimum [minBound..maxBound] :: Priority
--   Emergency
--   
--   >>> maximum [minBound..maxBound] :: Priority
--   Debug
--   
data Priority -- | the system is unusable Emergency :: Priority -- | action must be taken immediately Alert :: Priority -- | critical conditions Critical :: Priority -- | error conditions Error :: Priority -- | warning conditions Warning :: Priority -- | normal but significant condition Notice :: Priority -- | informational Info :: Priority -- | debug-level messages Debug :: Priority -- | Translate a Priority into the system-dependent identifier -- that's used by the syslog(3) implementation. fromPriority :: Priority -> CInt instance GHC.Generics.Generic System.Posix.Syslog.Priority.Priority instance GHC.Enum.Enum System.Posix.Syslog.Priority.Priority instance GHC.Enum.Bounded System.Posix.Syslog.Priority.Priority instance GHC.Classes.Ord System.Posix.Syslog.Priority.Priority instance GHC.Classes.Eq System.Posix.Syslog.Priority.Priority instance GHC.Read.Read System.Posix.Syslog.Priority.Priority instance GHC.Show.Show System.Posix.Syslog.Priority.Priority -- | FFI bindings to syslog(3) from POSIX.1-2008. This -- module is intended for purposes of low-level implementation. Users of -- this library should prefer safer and more convenient API provided by -- System.Posix.Syslog. module System.Posix.Syslog.Options -- | The function openlog allows one to configure a handful of -- process-wide options that modify the bahavior of the syslog -- funcion. These options are pid, cons, -- odelay, and ndelay. data Option -- | Log the pid with each message. LogPID :: Option -- | Log on the console if errors occur while sending messages. Console :: Option -- | Delay all initialization until first syslog() call (default). DelayedOpen :: Option -- | Initalize the syslog system immediately. ImmediateOpen :: Option -- | The syslog system should not attempt to wait for child process it may -- have created. This option is required by applications who enable -- SIGCHLD themselves. DontWaitForChildren :: Option -- | Translate an Option into the system-dependent identifier that's -- used by the syslog(3) implementation. fromOption :: Option -> CInt instance GHC.Generics.Generic System.Posix.Syslog.Options.Option instance GHC.Classes.Eq System.Posix.Syslog.Options.Option instance GHC.Enum.Enum System.Posix.Syslog.Options.Option instance GHC.Enum.Bounded System.Posix.Syslog.Options.Option instance GHC.Read.Read System.Posix.Syslog.Options.Option instance GHC.Show.Show System.Posix.Syslog.Options.Option -- | Low-level FFI bindings to syslog(3) et al from -- POSIX.1-2008. This module is intended for purposes of low-level -- implementation. Users of this library should prefer safer and more -- convenient API provided by System.Posix.Syslog module System.Posix.Syslog.Functions -- | The POSIX function syslog(3) imported into Haskell directly as -- an "unsafe" C-API call. We chose this specific signature for the -- variadic function, because it's ideal for the efficient zero-copy -- implementation provided by the high-level function syslog. _syslog :: CInt -> CInt -> CString -> CInt -> IO () -- | The POSIX function openlog(3), imported into Haskell directly -- as an "unsafe" foreign function call. _openlog :: CString -> CInt -> CInt -> IO () -- | The POSIX function closelog(3) imported into Haskell directly -- as an "unsafe" foreign function call. _closelog :: IO () -- | The POSIX function setlogmask(3) imported into Haskell directly -- as an "unsafe" foreign function call. _setlogmask :: CInt -> IO CInt -- | The POSIX macro LOG_MASK() imported into Haskell directly as a -- pure, "unsafe" foreign function call. It does feel a little silly to -- bother with this functions since we pretty much know _logMask = -- (2^) for certain, but, well, POSIX provides this abstraction and -- so it's probably no good idea to make that assumption. _logMask :: CInt -> CInt -- | FFI bindings to syslog(3) from POSIX.1-2008. This -- module is intended for purposes of low-level implementation. Users of -- this library should prefer safer and more convenient API provided by -- System.Posix.Syslog. module System.Posix.Syslog.LogMask -- | Convert a set of logging priorities into a system-dependent binary -- representation suitable for calling _setlogmask. toLogMask :: [Priority] -> CInt -- | Decode the the system-dependent binary representation returned by -- _setlogmask back into a set of logging priorities. fromLogMask :: CInt -> [Priority] -- | FFI bindings to syslog(3) from POSIX.1-2008. This -- module is intended for purposes of low-level implementation. Users of -- this library should prefer safer and more convenient API provided by -- System.Posix.Syslog. module System.Posix.Syslog.Facility -- | Syslog distinguishes various system facilities. Most applications -- should log in USER. data Facility -- | kernel messages Kernel :: Facility -- | user-level messages (default unless set otherwise) User :: Facility -- | mail system Mail :: Facility -- | network news subsystem News :: Facility -- | UUCP subsystem UUCP :: Facility -- | system daemons Daemon :: Facility -- | security and authorization messages Auth :: Facility -- | clock daemon Cron :: Facility -- | line printer subsystem LPR :: Facility -- | reserved for local use Local0 :: Facility -- | reserved for local use Local1 :: Facility -- | reserved for local use Local2 :: Facility -- | reserved for local use Local3 :: Facility -- | reserved for local use Local4 :: Facility -- | reserved for local use Local5 :: Facility -- | reserved for local use Local6 :: Facility -- | reserved for local use Local7 :: Facility -- | Translate a Facility into the system-dependent identifier -- that's used by the syslog(3) implementation. fromFacility :: Facility -> CInt instance GHC.Generics.Generic System.Posix.Syslog.Facility.Facility instance GHC.Classes.Eq System.Posix.Syslog.Facility.Facility instance GHC.Enum.Enum System.Posix.Syslog.Facility.Facility instance GHC.Enum.Bounded System.Posix.Syslog.Facility.Facility instance GHC.Read.Read System.Posix.Syslog.Facility.Facility instance GHC.Show.Show System.Posix.Syslog.Facility.Facility -- | A Haskell interface to syslog(3) as specified in -- POSIX.1-2008. The entire public API lives in this module. There -- is a set of exposed modules available underneath this one, which -- contain various implementation details that may be useful to other -- developers who want to implement syslog-related functionality. -- Users of syslog, however, do not need those modules; -- System.Posix.Syslog has all you'll need. -- -- Check out the example program that demonstrates how to use this -- library. module System.Posix.Syslog -- | Log the given text message via syslog(3). Please note that -- log messages are committed to the log verbatim --- -- printf()-style text formatting features offered by the -- underlying system function are not available. If your log -- message reads "%s", then that string is exactly what will be -- written to the log. Also, log messages cannot contain \0 -- bytes. If they do, all content following that byte will be cut off -- because the C function assumes that the string ends there. -- -- The Haskell String type can be easily logged with -- withCStringLen: -- --
--   withCStringLen "Hello, world." $ syslog (Just User) Info
--   
-- -- ByteStrings can be logged in the same way with the -- unsafeUseAsCStringLen function from -- Data.ByteString.Unsafe, which extracts a CStringLen -- from the ByteString in constant time (no copying!). syslog :: Maybe Facility -> Priority -> CStringLen -> IO () -- | Log messages are prioritized with one of the following levels: -- --
--   >>> [minBound..maxBound] :: [Priority]
--   [Emergency,Alert,Critical,Error,Warning,Notice,Info,Debug]
--   
-- -- The Ord instance for Priority considers the more urgent -- level lower than less urgent ones: -- --
--   >>> Emergency < Debug
--   True
--   
--   >>> minimum [minBound..maxBound] :: Priority
--   Emergency
--   
--   >>> maximum [minBound..maxBound] :: Priority
--   Debug
--   
data Priority -- | the system is unusable Emergency :: Priority -- | action must be taken immediately Alert :: Priority -- | critical conditions Critical :: Priority -- | error conditions Error :: Priority -- | warning conditions Warning :: Priority -- | normal but significant condition Notice :: Priority -- | informational Info :: Priority -- | debug-level messages Debug :: Priority -- | Syslog distinguishes various system facilities. Most applications -- should log in USER. data Facility -- | kernel messages Kernel :: Facility -- | user-level messages (default unless set otherwise) User :: Facility -- | mail system Mail :: Facility -- | network news subsystem News :: Facility -- | UUCP subsystem UUCP :: Facility -- | system daemons Daemon :: Facility -- | security and authorization messages Auth :: Facility -- | clock daemon Cron :: Facility -- | line printer subsystem LPR :: Facility -- | reserved for local use Local0 :: Facility -- | reserved for local use Local1 :: Facility -- | reserved for local use Local2 :: Facility -- | reserved for local use Local3 :: Facility -- | reserved for local use Local4 :: Facility -- | reserved for local use Local5 :: Facility -- | reserved for local use Local6 :: Facility -- | reserved for local use Local7 :: Facility -- | This function configures the process-wide hidden state of the system's -- syslog engine. It's probably a bad idea to call this function anywhere -- except at the very top of your program's main function. And -- even then you should probably prefer withSyslog instead, which -- guarantees that syslog is properly initialized within its scope. openlog :: CString -> [Option] -> Facility -> IO () -- | Release all syslog-related resources. closelog :: IO () -- | Run the given IO a computation within an initialized -- syslogging scope. The definition is: -- --
--   withSyslog ident opts facil f =
--     withCString ident $ ptr ->
--       bracket_ (openlog ptr opts facil) closelog f
--   
withSyslog :: String -> [Option] -> Facility -> IO a -> IO a -- | Configure a process-wide filter that determines which logging -- priorities are ignored and which ones are forwarded to the -- syslog implementation. For example, use setlogmask -- [Emergency .. Info] to filter out all debug-level messages from -- the message stream. Calling setlogmask [minBound..maxBound] -- enables everything. The special case setlogmask [] -- does nothing, i.e. the current filter configuration is not -- modified. This can be used to retrieve the current configuration. setlogmask :: [Priority] -> IO [Priority] -- | The function openlog allows one to configure a handful of -- process-wide options that modify the bahavior of the syslog -- funcion. These options are pid, cons, -- odelay, and ndelay. data Option -- | Log the pid with each message. LogPID :: Option -- | Log on the console if errors occur while sending messages. Console :: Option -- | Delay all initialization until first syslog() call (default). DelayedOpen :: Option -- | Initalize the syslog system immediately. ImmediateOpen :: Option -- | The syslog system should not attempt to wait for child process it may -- have created. This option is required by applications who enable -- SIGCHLD themselves. DontWaitForChildren :: Option