-- 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 <tt>syslog(3)</tt> as specified in
--   <a>POSIX.1-2008</a>. The entire public API lives in
--   <a>System.Posix.Syslog</a>. 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. <i>Users</i> of <tt>syslog</tt>,
--   however, do not need them.
--   
--   An example program that demonstrates how to use this library is
--   available in the <a>examples</a> directory of this package.
@package hsyslog
@version 5.0.2


-- | FFI bindings to <tt>syslog(3)</tt> from <a>POSIX.1-2008</a>. This
--   module is intended for purposes of low-level implementation. Users of
--   this library should prefer safer and more convenient API provided by
--   <a>System.Posix.Syslog</a>.
module System.Posix.Syslog.Facility

-- | Syslog distinguishes various system facilities. Most applications
--   should log in <tt>USER</tt>.
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 <a>Facility</a> into the system-dependent identifier
--   that's used by the <tt>syslog(3)</tt> implementation.
fromFacility :: Facility -> CInt
instance GHC.Internal.Enum.Bounded System.Posix.Syslog.Facility.Facility
instance GHC.Internal.Enum.Enum System.Posix.Syslog.Facility.Facility
instance GHC.Classes.Eq System.Posix.Syslog.Facility.Facility
instance GHC.Internal.Generics.Generic System.Posix.Syslog.Facility.Facility
instance GHC.Internal.Read.Read System.Posix.Syslog.Facility.Facility
instance GHC.Internal.Show.Show System.Posix.Syslog.Facility.Facility


-- | Low-level FFI bindings to <tt>syslog(3)</tt> et al from
--   <a>POSIX.1-2008</a>. This module is intended for purposes of low-level
--   implementation. Users of this library should prefer safer and more
--   convenient API provided by <a>System.Posix.Syslog</a>
module System.Posix.Syslog.Functions

-- | The POSIX function <a>syslog(3)</a> 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 <a>syslog</a>.
_syslog :: CInt -> CInt -> CString -> CInt -> IO ()

-- | The POSIX function <a>openlog(3)</a>, imported into Haskell directly
--   as an "unsafe" foreign function call.
_openlog :: CString -> CInt -> CInt -> IO ()

-- | The POSIX function <a>closelog(3)</a> imported into Haskell directly
--   as an "unsafe" foreign function call.
_closelog :: IO ()

-- | The POSIX function <a>setlogmask(3)</a> imported into Haskell directly
--   as an "unsafe" foreign function call.
_setlogmask :: CInt -> IO CInt

-- | The POSIX macro <a>LOG_MASK()</a> 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 <tt> _logMask =
--   (2^) </tt> 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 <tt>syslog(3)</tt> from <a>POSIX.1-2008</a>. This
--   module is intended for purposes of low-level implementation. Users of
--   this library should prefer safer and more convenient API provided by
--   <a>System.Posix.Syslog</a>.
module System.Posix.Syslog.Options

-- | The function <tt>openlog</tt> allows one to configure a handful of
--   process-wide options that modify the behavior of the <tt>syslog</tt>
--   function. These options are <tt>pid</tt>, <tt>cons</tt>,
--   <tt>odelay</tt>, and <tt>ndelay</tt>.
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 <tt>syslog()</tt> call (default).
DelayedOpen :: Option

-- | Initialize 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
--   <tt>SIGCHLD</tt> themselves.
DontWaitForChildren :: Option

-- | Translate an <a>Option</a> into the system-dependent identifier that's
--   used by the <tt>syslog(3)</tt> implementation.
fromOption :: Option -> CInt
instance GHC.Internal.Enum.Bounded System.Posix.Syslog.Options.Option
instance GHC.Internal.Enum.Enum System.Posix.Syslog.Options.Option
instance GHC.Classes.Eq System.Posix.Syslog.Options.Option
instance GHC.Internal.Generics.Generic System.Posix.Syslog.Options.Option
instance GHC.Internal.Read.Read System.Posix.Syslog.Options.Option
instance GHC.Internal.Show.Show System.Posix.Syslog.Options.Option


-- | FFI bindings to <tt>syslog(3)</tt> from <a>POSIX.1-2008</a>. This
--   module is intended for purposes of low-level implementation. Users of
--   this library should prefer safer and more convenient API provided by
--   <a>System.Posix.Syslog</a>.
module System.Posix.Syslog.Priority

-- | Log messages are prioritized with one of the following levels:
--   
--   <pre>
--   &gt;&gt;&gt; [minBound..maxBound] :: [Priority]
--   [Emergency,Alert,Critical,Error,Warning,Notice,Info,Debug]
--   </pre>
--   
--   The <a>Ord</a> instance for <a>Priority</a> considers the more urgent
--   level lower than less urgent ones:
--   
--   <pre>
--   &gt;&gt;&gt; Emergency &lt; Debug
--   True
--   
--   &gt;&gt;&gt; minimum [minBound..maxBound] :: Priority
--   Emergency
--   
--   &gt;&gt;&gt; maximum [minBound..maxBound] :: Priority
--   Debug
--   </pre>
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 <a>Priority</a> into the system-dependent identifier
--   that's used by the <tt>syslog(3)</tt> implementation.
fromPriority :: Priority -> CInt
instance GHC.Internal.Enum.Bounded System.Posix.Syslog.Priority.Priority
instance GHC.Internal.Enum.Enum System.Posix.Syslog.Priority.Priority
instance GHC.Classes.Eq System.Posix.Syslog.Priority.Priority
instance GHC.Internal.Generics.Generic System.Posix.Syslog.Priority.Priority
instance GHC.Classes.Ord System.Posix.Syslog.Priority.Priority
instance GHC.Internal.Read.Read System.Posix.Syslog.Priority.Priority
instance GHC.Internal.Show.Show System.Posix.Syslog.Priority.Priority


-- | FFI bindings to <tt>syslog(3)</tt> from <a>POSIX.1-2008</a>. This
--   module is intended for purposes of low-level implementation. Users of
--   this library should prefer safer and more convenient API provided by
--   <a>System.Posix.Syslog</a>.
module System.Posix.Syslog.LogMask

-- | Convert a set of logging priorities into a system-dependent binary
--   representation suitable for calling <tt>_setlogmask</tt>.
toLogMask :: [Priority] -> CInt

-- | Decode the the system-dependent binary representation returned by
--   <tt>_setlogmask</tt> back into a set of logging priorities.
fromLogMask :: CInt -> [Priority]


-- | A Haskell interface to <tt>syslog(3)</tt> as specified in
--   <a>POSIX.1-2008</a>. 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.
--   <i>Users</i> of syslog, however, do not need those modules;
--   <a>System.Posix.Syslog</a> has all you'll need.
--   
--   Check out the <a>example program</a> that demonstrates how to use this
--   library.
module System.Posix.Syslog

-- | Log the given text message via <tt>syslog(3)</tt>. Please note that
--   log messages are committed to the log <i>verbatim</i> ---
--   <tt>printf()</tt>-style text formatting features offered by the
--   underlying system function are <i>not</i> available. If your log
--   message reads <tt>"%s"</tt>, then that string is exactly what will be
--   written to the log. Also, log messages cannot contain <tt>\0</tt>
--   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 <a>String</a> type can be easily logged with
--   <a>withCStringLen</a>:
--   
--   <pre>
--   withCStringLen "Hello, world." $ syslog (Just User) Info
--   </pre>
--   
--   <tt>ByteStrings</tt> can be logged in the same way with the
--   <tt>unsafeUseAsCStringLen</tt> function from
--   <tt>Data.ByteString.Unsafe</tt>, which extracts a <a>CStringLen</a>
--   from the <tt>ByteString</tt> in constant time (no copying!).
syslog :: Maybe Facility -> Priority -> CStringLen -> IO ()

-- | Log messages are prioritized with one of the following levels:
--   
--   <pre>
--   &gt;&gt;&gt; [minBound..maxBound] :: [Priority]
--   [Emergency,Alert,Critical,Error,Warning,Notice,Info,Debug]
--   </pre>
--   
--   The <a>Ord</a> instance for <a>Priority</a> considers the more urgent
--   level lower than less urgent ones:
--   
--   <pre>
--   &gt;&gt;&gt; Emergency &lt; Debug
--   True
--   
--   &gt;&gt;&gt; minimum [minBound..maxBound] :: Priority
--   Emergency
--   
--   &gt;&gt;&gt; maximum [minBound..maxBound] :: Priority
--   Debug
--   </pre>
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 <tt>USER</tt>.
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 <tt>main</tt> function. And
--   even then you should probably prefer <a>withSyslog</a> 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 <tt>IO a</tt> computation within an initialized
--   syslogging scope. The definition is:
--   
--   <pre>
--   withSyslog ident opts facil f =
--     <a>withCString</a> ident $ ptr -&gt;
--       <a>bracket_</a> (openlog ptr opts facil) closelog f
--   </pre>
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
--   <tt>syslog</tt> implementation. For example, use <tt>setlogmask
--   [Emergency .. Info]</tt> to filter out all debug-level messages from
--   the message stream. Calling <tt>setlogmask [minBound..maxBound]</tt>
--   enables <i>everything</i>. The special case <tt>setlogmask []</tt>
--   does <i>nothing</i>, i.e. the current filter configuration is not
--   modified. This can be used to retrieve the current configuration.
setlogmask :: [Priority] -> IO [Priority]

-- | The function <tt>openlog</tt> allows one to configure a handful of
--   process-wide options that modify the behavior of the <tt>syslog</tt>
--   function. These options are <tt>pid</tt>, <tt>cons</tt>,
--   <tt>odelay</tt>, and <tt>ndelay</tt>.
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 <tt>syslog()</tt> call (default).
DelayedOpen :: Option

-- | Initialize 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
--   <tt>SIGCHLD</tt> themselves.
DontWaitForChildren :: Option
