1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

o Changed the multilog API a bit (I warned you)

- multilog_add_type, multilog_del_type, multilog_custom, and
     multilog_init_verbose all have different arguments.
   - Primary change is that caller only passes in config info, and the
     lib keeps track of state internally.  No more exporting of
     'struct log_data'.
   - Custom callers now only get the custom data pointer passed into their
     log fxn (that is set with multilog_custom)
   - Added basic README that describes libmultilog
This commit is contained in:
AJ Lewis 2005-05-09 18:44:35 +00:00
parent c44c04a6d7
commit bca1803fea
2 changed files with 5 additions and 17 deletions

View File

@ -96,7 +96,6 @@ int main(int argc, char **argv)
{
int list = 0, next = 0, ret, reg = default_reg;
char *device, *device_arg = NULL, *dso_name, *dso_name_arg = NULL;
struct log_data *ldata;
if (!parse_argv(argc, argv, &dso_name_arg, &device_arg, &reg, &list))
exit(EXIT_FAILURE);
@ -115,14 +114,9 @@ int main(int argc, char **argv)
exit(EXIT_FAILURE);
}
if(!(ldata = malloc(sizeof(*ldata))))
exit(ENOMEM);
if(!memset(ldata, 0, sizeof(*ldata)))
exit(ENOMEM);
/* FIXME: use -v/-q options to set this */
ldata->verbose_level = _LOG_DEBUG;
multilog_add_type(standard, ldata);
multilog_add_type(standard, NULL);
multilog_init_verbose(standard, _LOG_DEBUG);
if (list) {
do {
@ -155,7 +149,7 @@ int main(int argc, char **argv)
}
out:
multilog_del_type(standard, ldata);
multilog_del_type(standard);
if (device)
free(device);

View File

@ -1021,12 +1021,6 @@ int main(void)
{
struct fifos fifos;
struct log_data *tsdata = malloc(sizeof(*tsdata));
if(!tsdata)
exit(-ENOMEM);
if(!memset(tsdata, 0, sizeof(*tsdata)))
exit(-ENOMEM);
/* Make sure, parent accepts HANGUP signal. */
init_thread_signals(1);
@ -1042,8 +1036,8 @@ int main(void)
kill(getppid(), HANGUP);
multilog_clear_logging();
tsdata->verbose_level = _LOG_DEBUG;
multilog_add_type(threaded_syslog, tsdata);
multilog_add_type(threaded_syslog, NULL);
multilog_init_verbose(threaded_syslog, _LOG_DEBUG);
init_fifos(&fifos);
pthread_mutex_init(&mutex, NULL);