+void yf::Log::Impl::LFile::log(const std::string &date_format,
+ std::ostringstream &os)
+{
+ if (fhandle)
+ {
+ char datestr[80];
+ time_t ti = time(0);
+#if HAVE_LOCALTIME_R
+ struct tm tm0, *tm = &tm0;
+ localtime_r(&ti, tm);
+#else
+ struct tm *tm = localtime(&ti);
+#endif
+ if (strftime(datestr, sizeof(datestr)-1, date_format.c_str(), tm))
+ {
+ fputs(datestr, fhandle);
+ fputs(" ", fhandle);
+ }
+ fputs(os.str().c_str(), fhandle);
+ fputc('\n', fhandle);
+ }
+ else
+ yaz_log(YLOG_LOG, "%s", os.str().c_str());
+}