#pragma once
#include <iostream>
#include <sstream>
+#include "config.h"
#if !defined(RECURSOR)
#include <syslog.h>
#else
extern bool g_verbose;
extern bool g_syslog;
+#ifdef DNSDIST
+extern bool g_logtimestamps;
+#endif
inline void setSyslogFacility(int facility)
{
{
std::ostringstream str;
dolog(str, s, args...);
+
if(g_syslog)
syslog(level, "%s", str.str().c_str());
+
+#ifdef DNSDIST
+ if (g_logtimestamps) {
+ char buffer[50] = "";
+ struct tm tm;
+ time_t t;
+ time(&t);
+ localtime_r(&t, &tm);
+ strftime(buffer, sizeof(buffer), "%b %d %H:%M:%S ", &tm);
+ std::cout<<buffer;
+ }
+#endif
+
std::cout<<str.str()<<std::endl;
}