+__printf_2_3 void dss_log(int ll, const char* fmt,...)
+{
+ va_list argp;
+ FILE *outfd;
+ struct tm *tm;
+ time_t t1;
+ char str[255] = "";
+
+ if (ll < conf.loglevel_arg)
+ return;
+ outfd = logfile? logfile : stderr;
+ time(&t1);
+ tm = localtime(&t1);
+ strftime(str, sizeof(str), "%b %d %H:%M:%S", tm);
+ fprintf(outfd, "%s ", str);
+ if (conf.loglevel_arg <= INFO)
+ fprintf(outfd, "%i: ", ll);
+ va_start(argp, fmt);
+ vfprintf(outfd, fmt, argp);
+ va_end(argp);
+}
+
+/**
+ * Print a message either to stdout or to the log file.
+ */
+__printf_1_2 void dss_msg(const char* fmt,...)
+{
+ FILE *outfd = conf.daemon_given? logfile : stdout;
+ va_list argp;
+ va_start(argp, fmt);
+ vfprintf(outfd, fmt, argp);
+ va_end(argp);
+}
+