}
int open_log_file(int fd, FILE **fp, const char *filename, int *enabled_syslog) {
- int f, t;
+ int f;
if(!filename || !*filename || !strcmp(filename, "none"))
filename = "/dev/null";
if(fd != f && fd != -1) {
// it automatically closes
- t = dup2(f, fd);
+ int t = dup2(f, fd);
if (t == -1) {
error("Cannot dup2() new fd %d to old fd %d for '%s'", f, fd, filename);
close(f);
// prevent all logs if the errors per period is 0
if(error_log_errors_per_period == 0)
+#ifdef NETDATA_INTERNAL_CHECKS
+ return 0;
+#else
return 1;
+#endif
- time_t now = time(NULL);
+ time_t now = now_monotonic_sec();
if(!start) start = now;
if(reset) {
prevented++;
// prevent logging this error
+#ifdef NETDATA_INTERNAL_CHECKS
+ return 0;
+#else
return 1;
+#endif
}
return 0;
time_t t;
struct tm *tmp, tmbuf;
- t = time(NULL);
+ t = now_realtime_sec();
tmp = localtime_r(&t, &tmbuf);
if (tmp == NULL) return;