[BACK]Return to log.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / tmux

Diff for /src/usr.bin/tmux/log.c between version 1.24 and 1.25

version 1.24, 2017/02/04 23:42:53 version 1.25, 2017/06/04 08:25:57
Line 62 
Line 62 
   
         if (log_level == 0)          if (log_level == 0)
                 return;                  return;
           log_close();
   
         if (log_file != NULL)  
                 fclose(log_file);  
   
         xasprintf(&path, "tmux-%s-%ld.log", name, (long)getpid());          xasprintf(&path, "tmux-%s-%ld.log", name, (long)getpid());
         log_file = fopen(path, "w");          log_file = fopen(path, "a");
         free(path);          free(path);
         if (log_file == NULL)          if (log_file == NULL)
                 return;                  return;
   
         setvbuf(log_file, NULL, _IOLBF, 0);          setvbuf(log_file, NULL, _IOLBF, 0);
         event_set_log_callback(log_event_cb);          event_set_log_callback(log_event_cb);
   }
   
   /* Toggle logging. */
   void
   log_toggle(const char *name)
   {
           if (log_level == 0) {
                   log_level = 1;
                   log_open(name);
                   log_debug("log opened");
           } else {
                   log_debug("log closed");
                   log_level = 0;
                   log_close();
           }
 }  }
   
 /* Close logging. */  /* Close logging. */

Legend:
Removed from v.1.24  
changed lines
  Added in v.1.25