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


-- | Haskell bindings to libsystemd-journal
--   
--   Haskell bindings to libsystemd-journal
@package libsystemd-journal
@version 1.1.0

module Systemd.Journal

-- | Send a message to the systemd journal.
--   
--   <pre>
--   sendMessage t == sendJournalFields (message t)
--   </pre>
sendMessage :: Text -> IO ()

-- | Send a message and supply extra fields.
--   
--   Note: The <tt>MESSAGE</tt> field will be replaced with the first
--   parameter to this function. If you don't want this, use
--   <a>sendJournalFields</a>
sendMessageWith :: Text -> JournalFields -> IO ()

-- | Send an exact set of fields to the systemd journal.
sendJournalFields :: JournalFields -> IO ()

-- | A structured object of all the fields in an entry in the journal. You
--   generally don't construct this yourself, but you use the monoid
--   instance and smart constructors below.
--   
--   For example,
--   
--   <pre>
--   sendJournalFields (message "Oh god, it burns!" &lt;&gt; priority Emergency)
--   </pre>
type JournalFields = HashMap JournalField ByteString

-- | The human readable message string for this entry. This is supposed to
--   be the primary text shown to the user. It is usually not translated
--   (but might be in some cases), and is not supposed to be parsed for
--   meta data.
message :: Text -> JournalFields

-- | A 128bit message identifier ID for recognizing certain message types,
--   if this is desirable. Developers can generate a new ID for this
--   purpose with <tt>journalctl --new-id</tt>.
messageId :: UUID -> JournalFields

-- | A priority value compatible with syslog's priority concept.
priority :: Priority -> JournalFields

-- | Log messages are prioritized.
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

-- | The source code file generating this message.
codeFile :: FilePath -> JournalFields

-- | The source code line number generating this message.
codeLine :: Int -> JournalFields

-- | The source code function name generating this message.
codeFunc :: Text -> JournalFields

-- | The low-level Unix error number causing this entry, if any. Contains
--   the numeric value of <tt>errno(3)</tt>.
errno :: Int -> JournalFields

-- | Syslog compatibility field.
syslogFacility :: Facility -> JournalFields

-- | Syslog compatibility field.
syslogIdentifier :: Text -> JournalFields

-- | Syslog compatibility field.
syslogPid :: CPid -> JournalFields
data JournalField

-- | Construct a <a>JournalField</a> by converting to uppercase, as
--   required by the journal.
mkJournalField :: Text -> JournalField

-- | Opens the journal for reading, optionally filtering the journal
--   entries. Filters are defined as arbitrary binary expression trees,
--   which are then rewritten to be in conjunctive normal form before
--   filtering with systemd to comply with systemd's rule system.
openJournal :: MonadSafe m => [JournalFlag] -> Start -> Maybe Filter -> Producer' JournalEntry m ()

-- | Where to begin reading the journal from.
data Start

-- | Begin reading from the start of the journal.
FromStart :: Start

-- | Begin reading from the end of the journal.
FromEnd :: Start

-- | From a <a>JournalEntryCursor</a>.
FromCursor :: JournalEntryCursor -> Start

-- | An entry that has been read from the systemd journal.
data JournalEntry
type JournalEntryCursor = ByteString

-- | A map of each <a>JournalField</a> to its value.
journalEntryFields :: JournalEntry -> JournalFields

-- | A <tt>JournalCursor</tt> can be used as marker into the journal
--   stream. This can be used to re-open the journal at a specific point in
--   the future, and <tt>JournalCursor</tt>s can be serialized to disk.
journalEntryCursor :: JournalEntry -> JournalEntryCursor

-- | Flags to specify which journal entries to read.
data JournalFlag

-- | Only journal files generated on the local machine will be opened.
LocalOnly :: JournalFlag

-- | Only volatile journal files will be opened, excluding those which are
--   stored on persistent storage.
RuntimeOnly :: JournalFlag

-- | Only journal files of system services and the kernel (in opposition to
--   user session processes) will be opened.
SystemOnly :: JournalFlag

-- | A logical expression to filter journal entries when reading the
--   journal.
data Filter

-- | A binary exact match on a given <a>JournalField</a>.
Match :: JournalField -> ByteString -> Filter

-- | Logical conjunction of two filters. Will only show journal entries
--   that satisfy both conditions.
And :: Filter -> Filter -> Filter

-- | Logical disjunction of two filters. Will show journal entries that
--   satisfy either condition.
Or :: Filter -> Filter -> Filter
instance Typeable JournalField
instance Typeable Filter
instance Eq JournalField
instance Data JournalField
instance Hashable JournalField
instance Ord JournalField
instance Read JournalField
instance Show JournalField
instance Monoid JournalField
instance Bounded JournalFlag
instance Enum JournalFlag
instance Eq JournalFlag
instance Ord JournalFlag
instance Eq JournalEntry
instance Show JournalEntry
instance Data Filter
instance Eq Filter
instance Show Filter
instance IsString JournalField
