Changed log manager API to support variable length formatted log strings. New API is as follows:

/** No change in these */
bool skygw_logmanager_init(void** buf, int argc, char* argv[]);
void skygw_logmanager_done(void** buf);
void skygw_logmanager_exit(void);
int  skygw_log_flush(logfile_id_t id);

/** writebuf remains unused, but formatted string is now possible and in case 
 * of formatted string, arbitrary long argument list is supported too. Max 
 * length for a log string is defined to BUFSIZ, whose value depends on the 
 * system but typically is 4/8KB.
 */
int  skygw_log_write(void* writebuf, logfile_id_t id, char* format, ...);
int  skygw_log_write_flush(void* writebuf, logfile_id_t id, char* format, ...);

makefile.inc includes new CFLAG : SS_PROF, which is set if PROF=Y on make command line or in build_gateway.inc .
ss_debug.h includes corresponding ss_prof(exp) macro which equals to exp if SS_PROF is defined and to empty if in other case.

mlist_t now includes datadel function which is a callback and it is executed for mlnode_data on node exit.
This commit is contained in:
vraatikka
2013-07-02 14:46:39 +03:00
parent 1888b8a517
commit d11741130d
7 changed files with 556 additions and 222 deletions

View File

@ -18,6 +18,8 @@
#include <assert.h>
#define __USE_UNIX98 1
#include <pthread.h>
#include <unistd.h>
@ -35,6 +37,16 @@
#define EXTERN_C_FUNC
#endif
#if defined(SS_DEBUG)
# define SS_PROF
#endif
#if defined(SS_DEBUG) || defined(SS_PROF)
# define ss_prof(exp) exp
#else
# define ss_prof(exp)
#endif /* SS_DEBUG || SS_PROF */
#if defined(SS_DEBUG)
# define ss_debug(exp) exp
# define ss_dfprintf fprintf
@ -288,4 +300,10 @@ typedef enum skygw_chk_t {
f->sf_chk_tail == CHK_NUM_FILE, \
"File struct under- or overflow"); \
}
#define CHK_WRITEBUF(w) { \
ss_info_dassert(w->wb_chk_top == CHK_NUM_WRITEBUF, \
"Writebuf under- or overflow"); \
}
#endif /* SKYGW_DEBUG_H */