/[pdpsoft]/trunk/grid-mw-security/ees/src/eef/eef_log.c
ViewVC logotype

Annotation of /trunk/grid-mw-security/ees/src/eef/eef_log.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 858 - (hide annotations) (download) (as text)
Tue Sep 29 15:40:57 2009 UTC (12 years, 7 months ago) by aramv
File MIME type: text/x-chdr
File size: 1010 byte(s)
Fixed stupid const mistake, removed extensions hack
1 aramv 781 #include "eef.h"
2 aramv 502 #include <time.h>
3 aramv 844
4 aramv 810 EES_RC eef_log(int priority, const char* format, ...){
5 aramv 502 va_list args;
6 aramv 844 /*time_t _time;*/
7     /*struct tm * _time_s;*/
8     /*char _strf_fmt[MAX_TIME_STRING_SIZE];*/
9 aramv 502
10 aramv 844 /*_time = time(NULL);*/
11     /*_time_s = localtime(&_time);*/
12     /*strftime(_strf_fmt, MAX_TIME_STRING_SIZE, "%G", _time_s);*/
13 aramv 502
14 aramv 856 va_start(args, format);
15 aramv 810 if(priority == LOG_ERR){
16 aramv 857 vfprintf(stderr, append_newline(format), args);
17 aramv 810 }
18     va_end(args);
19     #if ENABLE_DEBUG
20     va_start(args, format);
21     if(priority == LOG_DEBUG){
22 aramv 857 vfprintf(stdout, append_newline(format), args);
23 aramv 810 }
24     va_end(args);
25     #endif
26     va_start(args, format);
27 aramv 460 vsyslog(priority, format, args);
28 aramv 429 va_end(args);
29     return 0;
30     }
31 aramv 856
32 aramv 858 const char* append_newline(const char* string){
33     char* mutable_string;
34 aramv 856 if(!strchr(string, '\n')){
35 aramv 858 mutable_string = strdup(string);
36     mutable_string = realloc(mutable_string, (sizeof(char) * (strlen(string)+1)));
37     strncat(mutable_string, "\n", 1);
38     return mutable_string;
39 aramv 856 }
40     return string;
41     }

Properties

Name Value
svn:mergeinfo

grid.support@nikhef.nl
ViewVC Help
Powered by ViewVC 1.1.28