示例#1
0
static void
_signal_log(int sig __UNUSED__)
{
   PT("reopen the log file\n");
   entrance_close_log();
   _open_log();
}
示例#2
0
int mlog_printf(int suppress_header, int module_index, int level, const char *fn, const char *fname, int line, const char *fmt, ...)
{
  va_list args;
//  int err;
  int n = 0;

  if (level > _mlog_table[module_index]) return(0);
  if (level > _log_level) return(0);

  if (_log_lock == NULL) _log_init();

  _lock_log();
  if (_log_fd == NULL) {_log_fd = stdout; _log_special=1; }

  if (suppress_header == 0) n = fprintf(_log_fd, "[mi=%d tid=%d file=%s:%d fn=%s] ", module_index, atomic_thread_id, fname, line, fn);
  va_start(args, fmt);
  n += vfprintf(_log_fd, fmt, args);
  va_end(args);

  _log_currsize += n;
  if (_log_currsize > _log_maxsize) {
//     if (_log_special==0) ftruncate(fileno(_log_fd), 0L);
     if (_log_special==0) { fclose(_log_fd); _open_log(NULL, 0); }
     _log_currsize = 0;
  }
  _unlock_log();

  return(n);
}
示例#3
0
static void
_signal_log(int sig)
{
   fprintf(stderr, PACKAGE": signal %d received reopen the log file\n", sig);
   elsa_close_log();
   _open_log();
}