*
* Email: crh@ubiqx.mn.org
*
- * $Id: PD_utils.c 2012-06-12 21:44:48 -0500 crh$
+ * $Id: PD_utils.c 2012-06-20 11:57:31 -0500 crh$
*
* -------------------------------------------------------------------------- **
*
} /* setLogTimeStamp */
-void Log( char *fmt, ... )
+void vLog( char *fmt, va_list ap )
/* ------------------------------------------------------------------------ **
- * Send a log message to the log file.
+ * Send a message to the log file.
*
* Input: fmt - Format string, as used in printf(), etc.
- * ... - Variable parameter list.
+ * ap - Variable parameter list.
*
* Output: <none>
*
* from multiple other modules. It's not just used by the main
* program.
*
+ * This function serves the same purpose as <Log()>, below, except
+ * that it is called with a va_list instead of a variable number
+ * of arguments.
+ *
* ------------------------------------------------------------------------ **
*/
{
- va_list ap;
-
- va_start( ap, fmt );
if( NULL == LogF )
vsyslog( LOG_NOTICE, fmt, ap );
else
(void)fprintf( LogF, "%s ", timestamp() );
(void)vfprintf( LogF, fmt, ap );
}
+ } /* vLog */
+
+
+void Log( char *fmt, ... )
+ /* ------------------------------------------------------------------------ **
+ * Send a log message to the log file.
+ *
+ * Input: fmt - Format string, as used in printf(), etc.
+ * ... - Variable parameter list.
+ *
+ * Output: <none>
+ *
+ * Notes: When logging to syslog, all messages are written with priority
+ * level LOG_NOTICE.
+ *
+ * Each call to syslog() (or vsyslog()) generates a new log
+ * message, so we cannot compose compound messages by calling
+ * this function multiple times. Compose first, call once.
+ *
+ * This function is in the PD_utils module because it is called
+ * from multiple other modules. It's not just used by the main
+ * program.
+ *
+ * See Also: <vLog()>
+ *
+ * ------------------------------------------------------------------------ **
+ */
+ {
+ va_list ap;
+
+ va_start( ap, fmt );
+ vLog( fmt, ap );
va_end( ap );
} /* Log */
* Notes: This is almost identical to <Log()> except that it calls
* exit(3), passing the value of <status>.
*
+ * See Also: <vLog()>
+ *
* ------------------------------------------------------------------------ **
*/
{
va_list ap;
va_start( ap, fmt );
- if( NULL == LogF )
- vsyslog( LOG_NOTICE, fmt, ap );
- else
- {
- if( tStamp )
- (void)fprintf( LogF, "%s ", timestamp() );
- (void)vfprintf( LogF, fmt, ap );
- }
+ vLog( fmt, ap );
va_end( ap );
exit( status );
*
* Email: crh@ubiqx.mn.org
*
- * $Id: PD_utils.h 2012-06-12 21:44:48 -0500 crh$
+ * $Id: PD_utils.h 2012-06-20 11:57:31 -0500 crh$
*
* -------------------------------------------------------------------------- **
*
*/
+void vLog( char *fmt, va_list ap );
+ /* ------------------------------------------------------------------------ **
+ * Send a message to the log file.
+ *
+ * Input: fmt - Format string, as used in printf(), etc.
+ * ap - Variable parameter list.
+ *
+ * Output: <none>
+ *
+ * Notes: When logging to syslog, all messages are written with priority
+ * level LOG_NOTICE.
+ *
+ * Each call to syslog() (or vsyslog()) generates a new log
+ * message, so we cannot compose compound messages by calling
+ * this function multiple times. Compose first, call once.
+ *
+ * This function is in the PD_utils module because it is called
+ * from multiple other modules. It's not just used by the main
+ * program.
+ *
+ * This function serves the same purpose as <Log()>, below, except
+ * that it is called with a va_list instead of a variable number
+ * of arguments.
+ *
+ * ------------------------------------------------------------------------ **
+ */
+
+
void Log( char *fmt, ... );
/* ------------------------------------------------------------------------ **
* Send a log message to the log file.
* from multiple other modules. It's not just used by the main
* program.
*
+ * See Also: <vLog()>
+ *
* ------------------------------------------------------------------------ **
*/
* Notes: This is almost identical to <Log()> except that it calls
* exit(3), passing the value of <status>.
*
+ * See Also: <vLog()>
+ *
* ------------------------------------------------------------------------ **
*/