syslog :: Maybe FacilityCategorize this message as belonging into the given system facility. If left unspecified, the process-wide default will be used, which tends to be User by default.
-> PriorityLog with the specified priority.
-> CStringLenThe actual log message. The string does not need to be terminated by a
\0byte. If the string does contain a\0byte, then the message ends there regardless of what the length argument says.-> IO ()
Log the given text message via syslog(3). Please note that log messages
are committed to the log verbatim --- printf()-style text formatting
features offered by the underlying system function are not available. If
your log message reads "%s", then that string is exactly what will be
written to the log. Also, log messages cannot contain \0 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 String type can be easily logged with withCStringLen:
withCStringLen "Hello, world." $ syslog (Just User) Info
ByteStrings can be logged in the same way with the unsafeUseAsCStringLen
function from Data.ByteString.Unsafe, which extracts a CStringLen from
the ByteString in constant time (no copying!).