-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | FFI interface to syslog(3) from POSIX.1-2001
--   
--   This library provides FFI bindings to syslog(3) from
--   <a>POSIX.1-2008</a>.
@package hsyslog
@version 4


-- | FFI bindings to syslog(3) from <a>POSIX.1-2008</a>.
module System.Posix.Syslog

-- | Log messages have a priority attached.
data Priority

-- | 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
toPriority :: CInt -> Priority
fromPriority :: Priority -> CInt

-- | Syslog distinguishes various system facilities. Most applications
--   should log in <a>USER</a>.
data Facility

-- | kernel messages
KERN :: Facility

-- | user-level messages (default unless set otherwise)
USER :: Facility

-- | mail system
MAIL :: Facility

-- | system daemons
DAEMON :: Facility

-- | security/authorization messages
AUTH :: Facility

-- | messages generated internally by syslogd
SYSLOG :: Facility

-- | line printer subsystem
LPR :: Facility

-- | network news subsystem
NEWS :: Facility

-- | UUCP subsystem
UUCP :: Facility

-- | clock daemon
CRON :: Facility

-- | security/authorization messages (effectively equals <a>AUTH</a> on
--   some systems)
AUTHPRIV :: Facility

-- | ftp daemon (effectively equals <a>DAEMON</a> on some systems)
FTP :: 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
toFacility :: CInt -> Facility
fromFacility :: Facility -> CInt

-- | <a>withSyslog</a> options for the syslog service.
data Option

-- | log the pid with each message
PID :: Option

-- | log on the console if errors in sending
CONS :: Option

-- | delay open until first <tt>syslog()</tt> (default)
ODELAY :: Option

-- | don't delay open
NDELAY :: Option

-- | don't wait for console forks: DEPRECATED
NOWAIT :: Option

-- | log to <tt>stderr</tt> as well (might be a no-op on some systems)
PERROR :: Option
toOption :: CInt -> Option
fromOption :: Option -> CInt

-- | <a>withSyslog</a> options for the priority mask.
data PriorityMask

-- | allow all messages thru
NoMask :: PriorityMask

-- | allow only messages with the priorities listed
Mask :: [Priority] -> PriorityMask

-- | allow only messages down to and including the specified priority
UpTo :: Priority -> PriorityMask
fromPriorityMask :: PriorityMask -> CInt
data SyslogConfig
SyslogConfig :: ByteString -> [Option] -> Facility -> PriorityMask -> SyslogConfig

-- | string appended to each log message
[identifier] :: SyslogConfig -> ByteString

-- | options for syslog behavior
[options] :: SyslogConfig -> [Option]

-- | facility logged to when none are provided (currently unsupported)
[defaultFacility] :: SyslogConfig -> Facility

-- | filter by priority which messages are logged
[priorityMask] :: SyslogConfig -> PriorityMask

-- | A practical default syslog config. You'll at least want to change the
--   identifier.
defaultConfig :: SyslogConfig

-- | Bracket an <a>IO</a> computation between calls to <a>_openlog</a>,
--   <a>_setlogmask</a>, and <a>_closelog</a>, providing a logging function
--   which can be used as follows:
--   
--   <pre>
--   main = withSyslog defaultConfig $ \syslog -&gt; do
--            putStrLn "huhu"
--            syslog USER Debug "huhu"
--   </pre>
--   
--   Note that these are <i>process-wide</i> settings, so multiple calls to
--   this function will interfere with each other in unpredictable ways.
withSyslog :: SyslogConfig -> (SyslogFn -> IO ()) -> IO ()

-- | The type of function provided by <a>withSyslog</a>.
type SyslogFn = Facility  the facility to log to -> Priority  the priority under which to log -> ByteString  the message to log -> IO ()

-- | Provides no guarantee that a call to <a>_openlog</a> has been made,
--   inviting unpredictable results.
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

-- | Calculate the full priority value of a <a>Facility</a> and
--   <a>Priority</a>
makePri :: Facility -> Priority -> CInt
instance GHC.Show.Show System.Posix.Syslog.SyslogConfig
instance GHC.Classes.Eq System.Posix.Syslog.SyslogConfig
instance GHC.Generics.Generic System.Posix.Syslog.PriorityMask
instance GHC.Read.Read System.Posix.Syslog.PriorityMask
instance GHC.Show.Show System.Posix.Syslog.PriorityMask
instance GHC.Classes.Eq System.Posix.Syslog.PriorityMask
instance GHC.Generics.Generic System.Posix.Syslog.Option
instance GHC.Read.Read System.Posix.Syslog.Option
instance GHC.Show.Show System.Posix.Syslog.Option
instance GHC.Classes.Eq System.Posix.Syslog.Option
instance GHC.Enum.Enum System.Posix.Syslog.Option
instance GHC.Enum.Bounded System.Posix.Syslog.Option
instance GHC.Generics.Generic System.Posix.Syslog.Facility
instance GHC.Read.Read System.Posix.Syslog.Facility
instance GHC.Show.Show System.Posix.Syslog.Facility
instance GHC.Classes.Eq System.Posix.Syslog.Facility
instance GHC.Enum.Enum System.Posix.Syslog.Facility
instance GHC.Enum.Bounded System.Posix.Syslog.Facility
instance GHC.Generics.Generic System.Posix.Syslog.Priority
instance GHC.Read.Read System.Posix.Syslog.Priority
instance GHC.Show.Show System.Posix.Syslog.Priority
instance GHC.Classes.Eq System.Posix.Syslog.Priority
instance GHC.Enum.Enum System.Posix.Syslog.Priority
instance GHC.Enum.Bounded System.Posix.Syslog.Priority
