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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 858 - (show 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 #include "eef.h"
2 #include <time.h>
3
4 EES_RC eef_log(int priority, const char* format, ...){
5 va_list args;
6 /*time_t _time;*/
7 /*struct tm * _time_s;*/
8 /*char _strf_fmt[MAX_TIME_STRING_SIZE];*/
9
10 /*_time = time(NULL);*/
11 /*_time_s = localtime(&_time);*/
12 /*strftime(_strf_fmt, MAX_TIME_STRING_SIZE, "%G", _time_s);*/
13
14 va_start(args, format);
15 if(priority == LOG_ERR){
16 vfprintf(stderr, append_newline(format), args);
17 }
18 va_end(args);
19 #if ENABLE_DEBUG
20 va_start(args, format);
21 if(priority == LOG_DEBUG){
22 vfprintf(stdout, append_newline(format), args);
23 }
24 va_end(args);
25 #endif
26 va_start(args, format);
27 vsyslog(priority, format, args);
28 va_end(args);
29 return 0;
30 }
31
32 const char* append_newline(const char* string){
33 char* mutable_string;
34 if(!strchr(string, '\n')){
35 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 }
40 return string;
41 }

Properties

Name Value
svn:mergeinfo

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