/[monit]/monit/log.c
ViewVC logotype

Diff of /monit/log.c

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

revision 1.15 by martinp, Wed Sep 24 18:08:55 2003 UTC revision 1.16 by hauk, Tue Sep 30 16:03:12 2003 UTC
# Line 89  Line 89 
89  /* ------------------------------------------------------------- Definitions */  /* ------------------------------------------------------------- Definitions */
90    
91    
 #define MESSAGE_SIZE 1024  
92  static FILE *LOG= NULL;  static FILE *LOG= NULL;
93  static char time_str[STRLEN];  static char time_str[STRLEN];
94    
# Line 134  int log_init() { Line 133  int log_init() {
133  /**  /**
134   * Log a message to monits logfile or syslog. If a TTY exist the log   * Log a message to monits logfile or syslog. If a TTY exist the log
135   * message is also sent to stderr.   * message is also sent to stderr.
136   * @param format A formated (printf-style) string to log   * @param s A formated (printf-style) string to log
137   */   */
138  void log_log(const char *format, ...) {  void log_log(const char *s, ...) {
139        
140      long len;
141    va_list ap;    va_list ap;
142    char msg[MESSAGE_SIZE];    char *msg= NULL;
143    
144    ASSERT(format);    ASSERT(s);
145        
146    va_start(ap,format);    va_start(ap,s);
147    vsnprintf(msg, MESSAGE_SIZE, format, ap);    msg= format(s, ap, &len);
148    va_end(ap);    va_end(ap);
149    
150    if(! Run.dolog) goto nolog;    if(! Run.dolog) goto nolog;
# Line 166  void log_log(const char *format, ...) { Line 166  void log_log(const char *format, ...) {
166      fflush(stderr);      fflush(stderr);
167            
168    }    }
169    
170      FREE(msg);
171        
172  }  }
173    

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.16

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26