/[LeafOK_CVS]/lbbs/src/log.c
ViewVC logotype

Diff of /lbbs/src/log.c

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

Revision 1.5 by sysadm, Thu Oct 21 17:28:46 2004 UTC Revision 1.6 by sysadm, Fri Oct 22 15:20:32 2004 UTC
# Line 15  Line 15 
15   *                                                                         *   *                                                                         *
16   ***************************************************************************/   ***************************************************************************/
17    
18  #include "common.h"  #include "io.h"
19    #include <stdio.h>
20    #include <stdarg.h>
21    #include <time.h>
22    
23  FILE *fp_log_std;  FILE *fp_log_std;
24  FILE *fp_log_err;  FILE *fp_log_err;
# Line 61  log_head (char *buf) Line 64  log_head (char *buf)
64  }  }
65    
66  int  int
67  log_std (char *msg)  log_std(const char * format, ...)
68  {  {
69      va_list args;
70      int retval;
71    char buf[1024];    char buf[1024];
72    
   if (fp_log_std == NULL)  
     {  
       perror ("log_std failed\n");  
       return -1;  
     }  
   
73    log_head(buf);    log_head(buf);
74      strcat(buf, format);
75    
76    strcat(buf,msg);    va_start (args, format);
77        retval = vfprintf (fp_log_std, format, args);
78    if (fprintf (fp_log_std, buf)<0)    va_end (args);
     {  
       perror ("log_std failed\n");  
       return -2;  
     }  
79    
80    fflush(fp_log_std);    fflush(fp_log_std);
81      
82    return 0;    return retval;
83  }  }
84    
85  int  int
86  log_error (char *error_msg)  log_error (const char * format, ...)
87  {  {
88      va_list args;
89      int retval;
90    char buf[1024];    char buf[1024];
     
   if (fp_log_err == NULL)  
     {  
       perror ("log_error failed\n");  
       return -1;  
     }  
91    
92    log_head(buf);    log_head(buf);
93      strcat(buf, format);
94    
95    strcat(buf,error_msg);    va_start (args, format);
96      retval = vfprintf (fp_log_err, format, args);
97      va_end (args);
98    
   if (fprintf (fp_log_err, buf)<0)  
     {  
       perror ("log_error failed\n");  
       return -2;  
     }  
     
99    fflush(fp_log_err);    fflush(fp_log_err);
100    
101    return 0;    return retval;
102  }  }
103    
104  int  int


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1