/[svn]/hopm/branches/1.1.x/src/log.c
ViewVC logotype

Diff of /hopm/branches/1.1.x/src/log.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 6970 by michael, Thu Jul 2 13:10:18 2015 UTC revision 6971 by michael, Sat Dec 19 20:30:07 2015 UTC
# Line 29  Line 29 
29    
30  #include "log.h"  #include "log.h"
31  #include "main.h"  #include "main.h"
32    #include "misc.h"
33    
34    
35  FILE *logfile;  FILE *logfile;
# Line 72  void Line 73  void
73  log_printf(const char *data, ...)  log_printf(const char *data, ...)
74  {  {
75    char data2[513];    char data2[513];
   char buf_present[32];  
76    va_list arglist;    va_list arglist;
   time_t present = 0;  
77    
78    if (OPT_DEBUG == 0 && logfile == NULL)    if (OPT_DEBUG == 0 && logfile == NULL)
79      return;      return;
80    
   time(&present);  
   strftime(buf_present, sizeof(buf_present), "%FT%H:%M:%S%z", localtime(&present));  
   
81    va_start(arglist, data);    va_start(arglist, data);
82    vsnprintf(data2, 512, data, arglist);    vsnprintf(data2, 512, data, arglist);
83    va_end(arglist);    va_end(arglist);
84    
85    if (OPT_DEBUG)    if (OPT_DEBUG)
86      fprintf(stderr, "[%s] %s\n", buf_present, data2);      fprintf(stderr, "[%s] %s\n", date_iso8601(0), data2);
87    else    else
88    {    {
89      fprintf(logfile, "[%s] %s\n", buf_present, data2);      fprintf(logfile, "[%s] %s\n", date_iso8601(0), data2);
90      fflush(logfile);      fflush(logfile);
91    }    }
92  }  }

Legend:
Removed from v.6970  
changed lines
  Added in v.6971

svnadmin@ircd-hybrid.org
ViewVC Help
Powered by ViewVC 1.1.28