mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-11 20:58:50 +03:00
dmeventd: enable new logging
This commit is contained in:
parent
c90363b585
commit
e50583d721
@ -16,14 +16,13 @@
|
|||||||
* dmeventd - dm event daemon to monitor active mapped devices
|
* dmeventd - dm event daemon to monitor active mapped devices
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "tool.h"
|
|
||||||
|
|
||||||
//#include "libmultilog.h"
|
|
||||||
#include "dm-logging.h"
|
#include "dm-logging.h"
|
||||||
|
|
||||||
#include "libdevmapper-event.h"
|
#include "libdevmapper-event.h"
|
||||||
#include "dmeventd.h"
|
#include "dmeventd.h"
|
||||||
|
|
||||||
|
#include "tool.h"
|
||||||
|
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <sys/file.h>
|
#include <sys/file.h>
|
||||||
@ -61,7 +60,6 @@
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* FIXME We use syslog for now, because multilog is not yet implemented */
|
|
||||||
#include <syslog.h>
|
#include <syslog.h>
|
||||||
|
|
||||||
static volatile sig_atomic_t _exit_now = 0; /* set to '1' when signal is given to exit */
|
static volatile sig_atomic_t _exit_now = 0; /* set to '1' when signal is given to exit */
|
||||||
@ -114,15 +112,14 @@ static char **_initial_registrations = 0;
|
|||||||
|
|
||||||
/* FIXME Make configurable at runtime */
|
/* FIXME Make configurable at runtime */
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
# define DEBUGLOG(fmt, args...) debuglog("[Thr %x]: " fmt, (int)pthread_self(), ## args)
|
# define DEBUGLOG log_debug
|
||||||
void debuglog(const char *fmt, ... ) __attribute__ ((format(printf, 1, 2)));
|
__attribute__((format(printf, 4, 5)))
|
||||||
|
static void _dmeventd_log(int level, const char *file, int line,
|
||||||
void debuglog(const char *fmt, ...)
|
const char *format, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
va_start(ap, format);
|
||||||
va_start(ap, fmt);
|
dm_event_log("dm", level, file, line, 0, format, ap);
|
||||||
vsyslog(LOG_DEBUG, fmt, ap);
|
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -634,24 +631,6 @@ static void _unregister_for_timeout(struct thread_status *thread)
|
|||||||
pthread_mutex_unlock(&_timeout_mutex);
|
pthread_mutex_unlock(&_timeout_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
__attribute__((format(printf, 4, 5)))
|
|
||||||
static void _no_intr_log(int level, const char *file, int line,
|
|
||||||
const char *f, ...)
|
|
||||||
{
|
|
||||||
va_list ap;
|
|
||||||
|
|
||||||
if (errno == EINTR)
|
|
||||||
return;
|
|
||||||
if (level > _LOG_WARN)
|
|
||||||
return;
|
|
||||||
|
|
||||||
va_start(ap, f);
|
|
||||||
vfprintf((level < _LOG_WARN) ? stderr : stdout, f, ap);
|
|
||||||
va_end(ap);
|
|
||||||
|
|
||||||
fputc('\n', (level < _LOG_WARN) ? stderr : stdout);
|
|
||||||
}
|
|
||||||
|
|
||||||
static sigset_t _unblock_sigalrm(void)
|
static sigset_t _unblock_sigalrm(void)
|
||||||
{
|
{
|
||||||
sigset_t set, old;
|
sigset_t set, old;
|
||||||
@ -2139,6 +2118,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
openlog("dmeventd", LOG_PID, LOG_DAEMON);
|
openlog("dmeventd", LOG_PID, LOG_DAEMON);
|
||||||
|
|
||||||
|
dm_event_log_set(_debug_level, _use_syslog);
|
||||||
|
dm_log_init(_dmeventd_log);
|
||||||
|
|
||||||
(void) dm_prepare_selinux_context(DMEVENTD_PIDFILE, S_IFREG);
|
(void) dm_prepare_selinux_context(DMEVENTD_PIDFILE, S_IFREG);
|
||||||
if (dm_create_lockfile(DMEVENTD_PIDFILE) == 0)
|
if (dm_create_lockfile(DMEVENTD_PIDFILE) == 0)
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user