<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.sharpfin.org/index.php?action=history&amp;feed=atom&amp;title=Log</id>
	<title>Log - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.sharpfin.org/index.php?action=history&amp;feed=atom&amp;title=Log"/>
	<link rel="alternate" type="text/html" href="https://www.sharpfin.org/index.php?title=Log&amp;action=history"/>
	<updated>2026-04-17T04:20:56Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.4</generator>
	<entry>
		<id>https://www.sharpfin.org/index.php?title=Log&amp;diff=132&amp;oldid=prev</id>
		<title>Philipp: Created page with &quot;== Overview ==  The Libreciva log function provides a support function to store and output log messages.  In order to use the library function, you must include the header file:  &lt;pre&gt; #include &quot;log.h&quot; &lt;/pre&gt;  === void log_init(char *progname, enum log_to dest, enum log_level, int colour) ===  This function must be called to initialise the log system.  The parameters are as follows:  ==== char *progname ====  This is the name of the program.  ==== enum log_to dest ==...&quot;</title>
		<link rel="alternate" type="text/html" href="https://www.sharpfin.org/index.php?title=Log&amp;diff=132&amp;oldid=prev"/>
		<updated>2025-06-08T11:33:50Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;== Overview ==  The &lt;a href=&quot;/index.php?title=Libreciva&quot; title=&quot;Libreciva&quot;&gt;Libreciva&lt;/a&gt; log function provides a support function to store and output log messages.  In order to use the library function, you must include the header file:  &amp;lt;pre&amp;gt; #include &amp;quot;log.h&amp;quot; &amp;lt;/pre&amp;gt;  === void log_init(char *progname, enum log_to dest, enum log_level, int colour) ===  This function must be called to initialise the log system.  The parameters are as follows:  ==== char *progname ====  This is the name of the program.  ==== enum log_to dest ==...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Overview ==&lt;br /&gt;
&lt;br /&gt;
The [[Libreciva]] log function provides a support function to store and output log messages.&lt;br /&gt;
&lt;br /&gt;
In order to use the library function, you must include the header file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;quot;log.h&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== void log_init(char *progname, enum log_to dest, enum log_level, int colour) ===&lt;br /&gt;
&lt;br /&gt;
This function must be called to initialise the log system.  The parameters are as follows:&lt;br /&gt;
&lt;br /&gt;
==== char *progname ====&lt;br /&gt;
&lt;br /&gt;
This is the name of the program.&lt;br /&gt;
&lt;br /&gt;
==== enum log_to dest ====&lt;br /&gt;
&lt;br /&gt;
This is the destination of the logger - it is either:&lt;br /&gt;
&lt;br /&gt;
* LOG_TO_STDERR&lt;br /&gt;
* LOG_TO_SYSLOG&lt;br /&gt;
&lt;br /&gt;
==== enum log_level ====&lt;br /&gt;
&lt;br /&gt;
This is the level of logging to report, it is one of the following:&lt;br /&gt;
&lt;br /&gt;
* LG_FTL&lt;br /&gt;
* LG_ERR&lt;br /&gt;
* LG_WRN&lt;br /&gt;
* LG_INF&lt;br /&gt;
* LG_DBG&lt;br /&gt;
&lt;br /&gt;
=== void logf(enum log_level level, char *format, ...)===&lt;br /&gt;
&lt;br /&gt;
This function adds a log entry to the logfile.  The level is one of:&lt;br /&gt;
&lt;br /&gt;
* LG_FTL&lt;br /&gt;
* LG_ERR&lt;br /&gt;
* LG_WRN&lt;br /&gt;
* LG_INF&lt;br /&gt;
* LG_DBG&lt;br /&gt;
&lt;br /&gt;
And the &amp;quot;format, ...&amp;quot; arguments are printf-compatible format string and arguments.&lt;br /&gt;
&lt;br /&gt;
=== void log_hexdump(char *txt, char *data, int len) ===&lt;br /&gt;
&lt;br /&gt;
This function dumps &amp;#039;&amp;#039;&amp;#039;len&amp;#039;&amp;#039;&amp;#039; bytes of &amp;#039;&amp;#039;&amp;#039;data&amp;#039;&amp;#039;&amp;#039; to the logfile, with a title of &amp;#039;&amp;#039;&amp;#039;txt&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;quot;log.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
main() {&lt;br /&gt;
  int x=2 ;&lt;br /&gt;
  log_init(&amp;quot;testprog&amp;quot;, LOG_TO_STDERR, LG_ERR, 0);&lt;br /&gt;
  logf(LG_ERR, &amp;quot;This is an error message, x=%d&amp;quot;, x);&lt;br /&gt;
  logf(LG_WRN, &amp;quot;This will not be output as the log_init level is LG_ERR&amp;quot;);&lt;br /&gt;
  logf(LG_FTL, &amp;quot;This log entry will cause a program exit&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Philipp</name></author>
	</entry>
</feed>