mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-17 06:04:23 +03:00
dmeventd: debug only subsystemd with # sign
Reword the logging logic and try to restore previous logging behavior for 'standalone' running daemon while preserving debuggable feautures it has gained. So actual rules: dmeventd without any '-d' option will syslog all messages from dmeventd.c it dmeventd plugins. log_notice()==log_verbose() log_info()==log_very_verbose() But to show also log_debug() used has to give '-ddd'. When user specified '-d, -dd, -ddd, -dddd' it will also enable tracing of messages from libdm & lib executed code - which is mainly useful for testing i.e.: 'dmeventd -fldddd'
This commit is contained in:
parent
33dd1f7747
commit
cd468b6218
@ -1,5 +1,6 @@
|
|||||||
Version 1.02.136 -
|
Version 1.02.136 -
|
||||||
======================================
|
======================================
|
||||||
|
Notice and Info messages are again logged from dmeventd and its plugins.
|
||||||
Dmeventd now also respects DM_ABORT_ON_INTERNAL_ERRORS as libdm based tool.
|
Dmeventd now also respects DM_ABORT_ON_INTERNAL_ERRORS as libdm based tool.
|
||||||
Report as non default dm logging also when logging with errno was changed.
|
Report as non default dm logging also when logging with errno was changed.
|
||||||
Use log_level() macro to consistently decode message log level in dmeventd.
|
Use log_level() macro to consistently decode message log level in dmeventd.
|
||||||
|
@ -872,22 +872,31 @@ void dm_event_log(const char *subsys, int level, const char *file,
|
|||||||
FILE *stream = log_stderr(level) ? stderr : stdout;
|
FILE *stream = log_stderr(level) ? stderr : stdout;
|
||||||
int prio;
|
int prio;
|
||||||
time_t now;
|
time_t now;
|
||||||
|
int log_with_debug = 0;
|
||||||
|
|
||||||
|
if (subsys[0] == '#') {
|
||||||
|
/* Subsystems starting with '#' are logged
|
||||||
|
* only when debugging is enabled. */
|
||||||
|
log_with_debug++;
|
||||||
|
subsys++;
|
||||||
|
}
|
||||||
|
|
||||||
switch (log_level(level)) {
|
switch (log_level(level)) {
|
||||||
case _LOG_DEBUG:
|
case _LOG_DEBUG:
|
||||||
|
/* Never shown without -ddd */
|
||||||
if (_debug_level < 3)
|
if (_debug_level < 3)
|
||||||
return;
|
return;
|
||||||
prio = LOG_DEBUG;
|
prio = LOG_DEBUG;
|
||||||
indent = " ";
|
indent = " ";
|
||||||
break;
|
break;
|
||||||
case _LOG_INFO:
|
case _LOG_INFO:
|
||||||
if (_debug_level < 2)
|
if (log_with_debug && _debug_level < 2)
|
||||||
return;
|
return;
|
||||||
prio = LOG_INFO;
|
prio = LOG_INFO;
|
||||||
indent = " ";
|
indent = " ";
|
||||||
break;
|
break;
|
||||||
case _LOG_NOTICE:
|
case _LOG_NOTICE:
|
||||||
if (_debug_level < 1)
|
if (log_with_debug && _debug_level < 1)
|
||||||
return;
|
return;
|
||||||
prio = LOG_NOTICE;
|
prio = LOG_NOTICE;
|
||||||
indent = " ";
|
indent = " ";
|
||||||
@ -913,12 +922,13 @@ void dm_event_log(const char *subsys, int level, const char *file,
|
|||||||
if (!start)
|
if (!start)
|
||||||
start = now;
|
start = now;
|
||||||
now -= start;
|
now -= start;
|
||||||
fprintf(stream, "[%2d:%02d] %8x:%-6s%s",
|
if (_debug_level)
|
||||||
(int)now / 60, (int)now % 60,
|
fprintf(stream, "[%2d:%02d] %8x:%-6s%s",
|
||||||
// TODO: Maybe use shorter ID
|
(int)now / 60, (int)now % 60,
|
||||||
// ((int)(pthread_self()) >> 6) & 0xffff,
|
// TODO: Maybe use shorter ID
|
||||||
(int)pthread_self(), subsys,
|
// ((int)(pthread_self()) >> 6) & 0xffff,
|
||||||
(_debug_level > 3) ? "" : indent);
|
(int)pthread_self(), subsys,
|
||||||
|
(_debug_level > 3) ? "" : indent);
|
||||||
if (_debug_level > 3)
|
if (_debug_level > 3)
|
||||||
fprintf(stream, "%28s:%4d %s", file, line, indent);
|
fprintf(stream, "%28s:%4d %s", file, line, indent);
|
||||||
vfprintf(stream, _(format), ap);
|
vfprintf(stream, _(format), ap);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user