chiark / gitweb /
journald: augment journal entries from the kernel with data from udev
[elogind.git] / man / sd_journal_print.xml
index 65694a2e301292ec2c11a3b308f397d9947b640c..c03762ac2ca9a5cc1af04ccabde8c4f1ea81c990 100644 (file)
@@ -47,6 +47,8 @@
                 <refname>sd_journal_printv</refname>
                 <refname>sd_journal_send</refname>
                 <refname>sd_journal_sendv</refname>
+                <refname>sd_journal_perror</refname>
+                <refname>SD_JOURNAL_SUPPRESS_LOCATION</refname>
                 <refpurpose>Submit log entries to the journal</refpurpose>
         </refnamediv>
 
                                 <paramdef>int <parameter>n</parameter></paramdef>
                         </funcprototype>
 
+                        <funcprototype>
+                                <funcdef>int <function>sd_journal_perror</function></funcdef>
+                                <paramdef>const char* <parameter>message</parameter></paramdef>
+                        </funcprototype>
+
                 </funcsynopsis>
         </refsynopsisdiv>
 
                 immediately followed by their associated parameters,
                 terminated by NULL. The strings passed should be of
                 the format <literal>VARIABLE=value</literal>. The
-                variable name must be in uppercase and consist only
-                of characters, numbers and underscores, and may not
-                begin with an underscore. The value can be of any size
-                and format. It is highly recommended to submit
-                text strings formatted in the UTF-8 character encoding
-                only, and submit binary fields only when formatting in
-                UTf-8 strings is not sensible. A number of well known
-                fields are defined, see
+                variable name must be in uppercase and consist only of
+                characters, numbers and underscores, and may not begin
+                with an underscore. (All assignments that do not
+                follow this syntax will be ignored.) The value can be
+                of any size and format. It is highly recommended to
+                submit text strings formatted in the UTF-8 character
+                encoding only, and submit binary fields only when
+                formatting in UTf-8 strings is not sensible. A number
+                of well known fields are defined, see
                 <citerefentry><refentrytitle>systemd.journal-fields</refentrytitle><manvolnum>7</manvolnum></citerefentry>
                 for details, but additional application defined fields
-                may be used.</para>
+                may be used. A variable may be assigned more than one
+                value per entry.</para>
 
                 <para><function>sd_journal_sendv()</function> is
                 similar to <function>sd_journal_send()</function> but
                 particularly useful to submit binary objects to the
                 journal where that is necessary.</para>
 
+                <para><function>sd_journal_perror()</function> is a
+                similar to
+                <citerefentry><refentrytitle>perror</refentrytitle><manvolnum>3</manvolnum></citerefentry>
+                and writes a message to the journal that consists of
+                the passed string, suffixed with ": " and a human
+                readable representation of the current error code
+                stored in
+                <citerefentry><refentrytitle>errno</refentrytitle><manvolnum>3</manvolnum></citerefentry>. If
+                the message string is passed as NULL or empty string
+                only the error string representation will be written,
+                prefixed with nothing. An additional journal field
+                ERRNO= is included in the entry containing the numeric
+                error code formatted as decimal string. The log
+                priority used is <literal>LOG_ERR</literal> (3).</para>
+
                 <para>Note that <function>sd_journal_send()</function>
                 is a wrapper around
                 <function>sd_journal_sendv()</function> to make it
@@ -171,7 +195,7 @@ sd_journal_send("MESSAGE=Hello World, this is PID %lu!", (unsigned long) getpid(
 
                 <para><citerefentry><refentrytitle>syslog</refentrytitle><manvolnum>3</manvolnum></citerefentry>
                 and and <function>sd_journal_print()</function> may
-                largely be used interchangably
+                largely be used interchangeably
                 functionality-wise. However, note that log messages
                 logged via the former take a different path to the
                 journal server than the later, and hence global
@@ -190,8 +214,10 @@ sd_journal_send("MESSAGE=Hello World, this is PID %lu!", (unsigned long) getpid(
         <refsect1>
                 <title>Return Value</title>
 
-                <para>The four calls return 0 on success or a
-                negative errno-style error code.</para>
+                <para>The four calls return 0 on success or a negative
+                errno-style error code. The
+                <citerefentry><refentrytitle>errno</refentrytitle><manvolnum>3</manvolnum></citerefentry>
+                variable itself is not altered.</para>
         </refsect1>
 
         <refsect1>
@@ -216,6 +242,8 @@ sd_journal_send("MESSAGE=Hello World, this is PID %lu!", (unsigned long) getpid(
                         <citerefentry><refentrytitle>sd-journal</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
                         <citerefentry><refentrytitle>sd_journal_stream_fd</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
                         <citerefentry><refentrytitle>syslog</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
+                        <citerefentry><refentrytitle>perror</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
+                        <citerefentry><refentrytitle>errno</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
                         <citerefentry><refentrytitle>systemd.journal-fields</refentrytitle><manvolnum>7</manvolnum></citerefentry>
                 </para>
         </refsect1>