    {-# LINE 1 "src/System/Posix/Syslog/Priority.hsc" #-}
    {-# LANGUAGE DeriveGeneric #-}

    {- |
       Maintainer: simons@cryp.to
       Stability: provisional
       Portability: POSIX

       FFI bindings to @syslog(3)@ from
       <http://pubs.opengroup.org/onlinepubs/9699919799/functions/syslog.html 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 where

    import Foreign.C
    import GHC.Generics ( Generic )

    -- * Message Priorities

    -- | 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 = Emergency       -- ^ the 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
      deriving (Int -> Priority -> ShowS
    [Priority] -> ShowS
    Priority -> String
    (Int -> Priority -> ShowS)
    -> (Priority -> String) -> ([Priority] -> ShowS) -> Show Priority
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> Priority -> ShowS
    showsPrec :: Int -> Priority -> ShowS
    $cshow :: Priority -> String
    show :: Priority -> String
    $cshowList :: [Priority] -> ShowS
    showList :: [Priority] -> ShowS
    Show, ReadPrec [Priority]
    ReadPrec Priority
    Int -> ReadS Priority
    ReadS [Priority]
    (Int -> ReadS Priority)
    -> ReadS [Priority]
    -> ReadPrec Priority
    -> ReadPrec [Priority]
    -> Read Priority
    forall a.
    (Int -> ReadS a)
    -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
    $creadsPrec :: Int -> ReadS Priority
    readsPrec :: Int -> ReadS Priority
    $creadList :: ReadS [Priority]
    readList :: ReadS [Priority]
    $creadPrec :: ReadPrec Priority
    readPrec :: ReadPrec Priority
    $creadListPrec :: ReadPrec [Priority]
    readListPrec :: ReadPrec [Priority]
    Read, Priority -> Priority -> Bool
    (Priority -> Priority -> Bool)
    -> (Priority -> Priority -> Bool) -> Eq Priority
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: Priority -> Priority -> Bool
    == :: Priority -> Priority -> Bool
    $c/= :: Priority -> Priority -> Bool
    /= :: Priority -> Priority -> Bool
    Eq, Eq Priority
    Eq Priority
    -> (Priority -> Priority -> Ordering)
    -> (Priority -> Priority -> Bool)
    -> (Priority -> Priority -> Bool)
    -> (Priority -> Priority -> Bool)
    -> (Priority -> Priority -> Bool)
    -> (Priority -> Priority -> Priority)
    -> (Priority -> Priority -> Priority)
    -> Ord Priority
    Priority -> Priority -> Bool
    Priority -> Priority -> Ordering
    Priority -> Priority -> Priority
    forall a.
    Eq a
    -> (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: Priority -> Priority -> Ordering
    compare :: Priority -> Priority -> Ordering
    $c< :: Priority -> Priority -> Bool
    < :: Priority -> Priority -> Bool
    $c<= :: Priority -> Priority -> Bool
    <= :: Priority -> Priority -> Bool
    $c> :: Priority -> Priority -> Bool
    > :: Priority -> Priority -> Bool
    $c>= :: Priority -> Priority -> Bool
    >= :: Priority -> Priority -> Bool
    $cmax :: Priority -> Priority -> Priority
    max :: Priority -> Priority -> Priority
    $cmin :: Priority -> Priority -> Priority
    min :: Priority -> Priority -> Priority
    Ord, Priority
    Priority -> Priority -> Bounded Priority
    forall a. a -> a -> Bounded a
    $cminBound :: Priority
    minBound :: Priority
    $cmaxBound :: Priority
    maxBound :: Priority
    Bounded, Int -> Priority
    Priority -> Int
    Priority -> [Priority]
    Priority -> Priority
    Priority -> Priority -> [Priority]
    Priority -> Priority -> Priority -> [Priority]
    (Priority -> Priority)
    -> (Priority -> Priority)
    -> (Int -> Priority)
    -> (Priority -> Int)
    -> (Priority -> [Priority])
    -> (Priority -> Priority -> [Priority])
    -> (Priority -> Priority -> [Priority])
    -> (Priority -> Priority -> Priority -> [Priority])
    -> Enum Priority
    forall a.
    (a -> a)
    -> (a -> a)
    -> (Int -> a)
    -> (a -> Int)
    -> (a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> a -> [a])
    -> Enum a
    $csucc :: Priority -> Priority
    succ :: Priority -> Priority
    $cpred :: Priority -> Priority
    pred :: Priority -> Priority
    $ctoEnum :: Int -> Priority
    toEnum :: Int -> Priority
    $cfromEnum :: Priority -> Int
    fromEnum :: Priority -> Int
    $cenumFrom :: Priority -> [Priority]
    enumFrom :: Priority -> [Priority]
    $cenumFromThen :: Priority -> Priority -> [Priority]
    enumFromThen :: Priority -> Priority -> [Priority]
    $cenumFromTo :: Priority -> Priority -> [Priority]
    enumFromTo :: Priority -> Priority -> [Priority]
    $cenumFromThenTo :: Priority -> Priority -> Priority -> [Priority]
    enumFromThenTo :: Priority -> Priority -> Priority -> [Priority]
    Enum, (forall x. Priority -> Rep Priority x)
    -> (forall x. Rep Priority x -> Priority) -> Generic Priority
    forall x. Rep Priority x -> Priority
    forall x. Priority -> Rep Priority x
    forall a.
    (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
    $cfrom :: forall x. Priority -> Rep Priority x
    from :: forall x. Priority -> Rep Priority x
    $cto :: forall x. Rep Priority x -> Priority
    to :: forall x. Rep Priority x -> Priority
    Generic)

    -- | Translate a 'Priority' into the system-dependent identifier that's used by
    -- the @syslog(3)@ implementation.

    {-# INLINE fromPriority #-}
    fromPriority :: Priority -> CInt
    fromPriority :: Priority -> CInt
    fromPriority Priority
    Emergency = CInt
    0
    {-# LINE 55 "src/System/Posix/Syslog/Priority.hsc" #-}
    fromPriority Alert     = 1
    {-# LINE 56 "src/System/Posix/Syslog/Priority.hsc" #-}
    fromPriority Critical  = 2
    {-# LINE 57 "src/System/Posix/Syslog/Priority.hsc" #-}
    fromPriority Error     = 3
    {-# LINE 58 "src/System/Posix/Syslog/Priority.hsc" #-}
    fromPriority Warning   = 4
    {-# LINE 59 "src/System/Posix/Syslog/Priority.hsc" #-}
    fromPriority Notice    = 5
    {-# LINE 60 "src/System/Posix/Syslog/Priority.hsc" #-}
    fromPriority Info      = 6
    {-# LINE 61 "src/System/Posix/Syslog/Priority.hsc" #-}
    fromPriority Debug     = 7
    {-# LINE 62 "src/System/Posix/Syslog/Priority.hsc" #-}