libsystemd-journal-1.0.0: Haskell bindings to libsystemd-journal

Safe HaskellNone

Systemd.Journal

Contents

Synopsis

Logging

logMessage :: Text -> IO ()

Log a message to the systemd journal.

logMessageWith :: Text -> LogProperties -> IO ()

Log a message and supply extra metadata. All metadata keys will be converted to uppercase for you.

Note: The Message meta-data property will be replaced with the first parameter to this function. If you don't want this, use logMap

Log Properties

type LogProperties = HashMap LogKey Text

A structured object of properties to log. You generally don't construct this yourself, but you use the monoid instance and smart constructors below. For example,

 logProperties (message "Oh god, it burns!" <> priority Emergency)

Standard systemd log properties

message :: Text -> LogProperties

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.

messageId :: UUID -> LogProperties

A 128bit message identifier ID for recognizing certain message types, if this is desirable. Developers can generate a new ID for this purpose with journalctl --new-id.

priority :: Priority -> LogProperties

A priority value compatible with syslog's priority concept.

data Priority

Log messages are prioritized.

Constructors

Emergency

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

codeFile :: FilePath -> LogProperties

The source code file generating this message.

codeLine :: Int -> LogProperties

The source code line number generating this message.

codeFunc :: Text -> LogProperties

The source code function name generating this message.

errno :: Int -> LogProperties

The low-level Unix error number causing this entry, if any. Contains the numeric value of errno(3).

syslogFacility :: Facility -> LogProperties

Syslog compatibility field.

syslogIdentifier :: Text -> LogProperties

Syslog compatibility field.

syslogPid :: CPid -> LogProperties

Syslog compatibility field.

Custom Properties

mkLogKey :: Text -> LogKey

Construct a LogKey by converting to uppercase, as required by the journal.