Log: No more argv parsing for log manager.
Earlier, the global setting for the syslog decided whether syslog was enabled when skygw_logmanager_init was called, but not whether logging to syslog actually was made. Now syslog logging is enabled by default and the global setting decides whether or not syslog logging actually is made. That is, this opens up the possiblity for making it possible to turn on and off sysloging at runtime. Further, although the API led you to believe otherwise, it was hardwired that LOGFILE_ERROR and LOGFILE_MESSAGE messages were written to syslog. The changed removed the need for passing an argv array explicitly.
This commit is contained in:
@ -31,7 +31,6 @@ int main(int argc, char** argv)
|
||||
char cwd[1024];
|
||||
char tmp[2048];
|
||||
char *message;
|
||||
char** optstr;
|
||||
long msg_index = 1;
|
||||
struct timespec ts1;
|
||||
ts1.tv_sec = 0;
|
||||
@ -55,7 +54,6 @@ int main(int argc, char** argv)
|
||||
}
|
||||
|
||||
if (getcwd(cwd, sizeof(cwd)) == NULL ||
|
||||
(optstr = (char**)malloc(sizeof(char*) * 4)) == NULL ||
|
||||
(message = (char*)malloc(sizeof(char) * block_size)) == NULL)
|
||||
{
|
||||
fprintf(stderr,"Fatal Error, exiting...");
|
||||
@ -65,13 +63,11 @@ int main(int argc, char** argv)
|
||||
memset(tmp, 0, 1024);
|
||||
|
||||
sprintf(tmp, "%s", cwd);
|
||||
optstr[0] = strdup("log_manager");
|
||||
optstr[1] = NULL;
|
||||
|
||||
iterations = atoi(argv[1]);
|
||||
interval = atoi(argv[2]);
|
||||
|
||||
succp = skygw_logmanager_init(NULL, tmp, LOG_TARGET_FS, 1, optstr);
|
||||
succp = skygw_logmanager_init(NULL, tmp, LOG_TARGET_FS);
|
||||
|
||||
if (!succp)
|
||||
{
|
||||
@ -114,10 +110,5 @@ int main(int argc, char** argv)
|
||||
skygw_log_flush(LOGFILE_ERROR);
|
||||
skygw_logmanager_done();
|
||||
free(message);
|
||||
free(optstr[0]);
|
||||
free(optstr[1]);
|
||||
free(optstr[2]);
|
||||
free(optstr[3]);
|
||||
free(optstr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user