Allow timeformat for log to be specified
authorAdam Dickmeiss <adam@indexdata.dk>
Wed, 24 Apr 2013 13:17:20 +0000 (15:17 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Wed, 24 Apr 2013 13:17:20 +0000 (15:17 +0200)
with option -m (as Metaproxy and YAZ GFS). Suggested by Sven Porst.

doc/pazpar2.xml
src/pazpar2.c

index 4cbe5f8..19e39ec 100644 (file)
@@ -34,6 +34,7 @@
    <arg choice="opt"><option>-f <replaceable>config</replaceable></option></arg>
    <arg choice="opt"><option>-h <replaceable>ip:port</replaceable></option></arg>
    <arg choice="opt"><option>-l <replaceable>logfile</replaceable></option></arg>
+   <arg choice="opt"><option>-m <replaceable>timeformat</replaceable></option></arg>
    <arg choice="opt"><option>-p <replaceable>pidfile</replaceable></option></arg>
    <arg choice="opt"><option>-R <replaceable>recfile</replaceable></option></arg>
    <arg choice="opt"><option>-t</option></arg>
     </listitem>
    </varlistentry>
    <varlistentry>
+    <term>-m <replaceable>timeformat</replaceable></term>
+    <listitem><para>
+     Sets the format of time-stamps for logging.
+     Refer to the
+       <ulink
+          url="http://pubs.opengroup.org/onlinepubs/009695399/functions/strftime.html">
+       strftime(3)</ulink>
+       man page for the format.
+    </para></listitem>
+   </varlistentry>
+   <varlistentry>
     <term><option>-p <replaceable>pidfile</replaceable></option></term>
     <listitem>
      <para>
index 80a7f59..6266d71 100644 (file)
@@ -118,7 +118,7 @@ static int sc_main(
     yaz_log_init_prefix("pazpar2");
     yaz_log_xml_errors(0, YLOG_WARN);
 
-    while ((ret = options("dDf:h:l:p:R:tu:v:Vw:X", argv, argc, &arg)) != -2)
+    while ((ret = options("dDf:h:l:m:p:R:tu:v:Vw:X", argv, argc, &arg)) != -2)
     {
        switch (ret)
         {
@@ -138,6 +138,9 @@ static int sc_main(
             yaz_log_init_file(arg);
             log_file_in_use = 1;
             break;
+        case 'm':
+            yaz_log_time_format(arg);
+            break;
         case 'p':
             pidfile = arg;
             break;
@@ -181,6 +184,7 @@ static int sc_main(
                     "    -f configfile           Configuration\n"
                     "    -h [host:]port          Listener port\n"
                     "    -l file                 Log to file\n"
+                    "    -m logformat            log time format (strftime)\n"
                     "    -p pidfile              PID file\n"
                     "    -R recfile              HTTP recording file\n"
                     "    -t                      Test configuration\n"