1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

ctdb-logging: Change LogLevel to DEBUGLEVEL

For compatibility with current Samba debug.[ch].

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Volker Lendecke <vl@samba.org>
This commit is contained in:
Martin Schwenke 2014-09-24 17:12:56 +10:00 committed by Volker Lendecke
parent 1c8c0be6f9
commit 3105737c4b
11 changed files with 24 additions and 24 deletions

View File

@ -97,9 +97,9 @@ struct ctdb_context *ctdb_cmdline_init(struct event_context *ev)
/* Set the debug level */
if (isalpha(ctdb_cmdline.debuglevel[0]) || ctdb_cmdline.debuglevel[0] == '-') {
LogLevel = get_debug_by_desc(ctdb_cmdline.debuglevel);
DEBUGLEVEL = get_debug_by_desc(ctdb_cmdline.debuglevel);
} else {
LogLevel = strtol(ctdb_cmdline.debuglevel, NULL, 0);
DEBUGLEVEL = strtol(ctdb_cmdline.debuglevel, NULL, 0);
}
/* set up the tree to store server ids */
@ -148,9 +148,9 @@ struct ctdb_context *ctdb_cmdline_client(struct tevent_context *ev,
/* Set the debug level */
if (isalpha(ctdb_cmdline.debuglevel[0]) || ctdb_cmdline.debuglevel[0] == '-') {
LogLevel = get_debug_by_desc(ctdb_cmdline.debuglevel);
DEBUGLEVEL = get_debug_by_desc(ctdb_cmdline.debuglevel);
} else {
LogLevel = strtol(ctdb_cmdline.debuglevel, NULL, 0);
DEBUGLEVEL = strtol(ctdb_cmdline.debuglevel, NULL, 0);
}
ret = ctdb_socket_connect(ctdb);

View File

@ -23,7 +23,7 @@
#include "../include/ctdb_private.h"
#include "../include/ctdb_client.h"
int LogLevel = DEBUG_NOTICE;
int DEBUGLEVEL = DEBUG_NOTICE;
int this_log_level = 0;
const char *debug_extra = "";

View File

@ -537,7 +537,7 @@ void ibwtest_usage(struct ibwtest_ctx *tcx, char *name)
printf("\t-n number of messages to send [default %d]\n", tcx->nmsg);
printf("\t-l usec time to sleep in the main loop [default %d]\n", tcx->sleep_usec);
printf("\t-v max variable msg size in bytes [default %d], 0=don't send var. size\n", tcx->maxsize);
printf("\t-d LogLevel [default %d]\n", LogLevel);
printf("\t-d LogLevel [default %d]\n", DEBUGLEVEL);
printf("Press ctrl+C to stop the program.\n");
}
@ -553,7 +553,7 @@ int main(int argc, char *argv[])
memset(tcx, 0, sizeof(struct ibwtest_ctx));
tcx->nsec = 0;
tcx->nmsg = 1000;
LogLevel = 0;
DEBUGLEVEL = 0;
/* here is the only case we can't avoid using global... */
testctx = tcx;
@ -592,7 +592,7 @@ int main(int argc, char *argv[])
tcx->maxsize = (unsigned int)atoi(optarg);
break;
case 'd':
LogLevel = atoi(optarg);
DEBUGLEVEL = atoi(optarg);
break;
default:
fprintf(stderr, "ERROR: unknown option -%c\n", (char)op);

View File

@ -20,7 +20,7 @@
#ifndef _CTDB_LOGGING_H_
#define _CTDB_LOGGING_H_
extern int LogLevel;
extern int DEBUGLEVEL;
extern int this_log_level;
extern const char *debug_extra;
@ -35,8 +35,8 @@ enum debug_level {
DEBUG_DEBUG = 4,
};
#define DEBUGLVL(lvl) ((lvl) <= LogLevel)
#define DEBUG(lvl, x) do { this_log_level = (lvl); if ((lvl) <= LogLevel) { do_debug x; }} while (0)
#define DEBUGADD(lvl, x) do { if ((lvl) <= LogLevel) { this_log_level = (lvl); do_debug_add x; }} while (0)
#define DEBUGLVL(lvl) ((lvl) <= DEBUGLEVEL)
#define DEBUG(lvl, x) do { this_log_level = (lvl); if ((lvl) <= DEBUGLEVEL) { do_debug x; }} while (0)
#define DEBUGADD(lvl, x) do { if ((lvl) <= DEBUGLEVEL) { this_log_level = (lvl); do_debug_add x; }} while (0)
#endif /* _CTDB_LOGGING_H_ */

View File

@ -108,14 +108,14 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
case CTDB_CONTROL_SET_DEBUG: {
CHECK_CONTROL_DATA_SIZE(sizeof(int32_t));
LogLevel = *(int32_t *)indata.dptr;
DEBUGLEVEL = *(int32_t *)indata.dptr;
return 0;
}
case CTDB_CONTROL_GET_DEBUG: {
CHECK_CONTROL_DATA_SIZE(0);
outdata->dptr = (uint8_t *)&LogLevel;
outdata->dsize = sizeof(LogLevel);
outdata->dptr = (uint8_t *)&(DEBUGLEVEL);
outdata->dsize = sizeof(DEBUGLEVEL);
return 0;
}

View File

@ -397,7 +397,7 @@ int ctdb_set_logfile(struct ctdb_context *ctdb, const char *logfile, bool use_sy
static void write_to_log(struct ctdb_log_state *log,
const char *buf, unsigned int len)
{
if (script_log_level <= LogLevel) {
if (script_log_level <= DEBUGLEVEL) {
if (log != NULL && log->prefix != NULL) {
do_debug("%s: %*.*s\n", log->prefix, len, len, buf);
} else {
@ -628,7 +628,7 @@ static void ctdb_tevent_logging(void *private_data,
break;
}
if (lvl <= LogLevel) {
if (lvl <= DEBUGLEVEL) {
this_log_level = lvl;
do_debug_v(fmt, ap);
}

View File

@ -3553,7 +3553,7 @@ static void main_loop(struct ctdb_context *ctdb, struct ctdb_recoverd *rec,
DEBUG(DEBUG_ERR, (__location__ " Failed to read debuglevel from parent\n"));
return;
}
LogLevel = debug_level;
DEBUGLEVEL = debug_level;
/* get relevant tunables */
ret = ctdb_ctrl_get_all_tunables(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE, &ctdb->tunable);

View File

@ -124,7 +124,7 @@ result_filter_default ()
_date_time_pid='[0-9/][0-9/]*\ [0-9:\.][0-9:\.]*\ \[[\ 0-9][\ 0-9]*\]'
sed -e "s@^${_date_time_pid}:@DATE\ TIME\ \[PID\]:@"
}
TEST_DATE_STAMP="DATE TIME [PID]: "
TEST_DATE_STAMP=""
# Override this function to customise output filtering.
result_filter ()

View File

@ -162,9 +162,9 @@ static void usage(void)
int main(int argc, const char *argv[])
{
LogLevel = DEBUG_DEBUG;
DEBUGLEVEL = DEBUG_DEBUG;
if (getenv("CTDB_TEST_LOGLEVEL")) {
LogLevel = atoi(getenv("CTDB_TEST_LOGLEVEL"));
DEBUGLEVEL = atoi(getenv("CTDB_TEST_LOGLEVEL"));
}
if (argc < 2) {

View File

@ -264,7 +264,7 @@ int main(int argc, const char *argv[])
int extra_argc = 0;
poptContext pc;
LogLevel = DEBUG_INFO;
DEBUGLEVEL = DEBUG_INFO;
pc = poptGetContext(argv[0], argc, argv, popt_options, POPT_CONTEXT_KEEP_FIRST);

View File

@ -598,9 +598,9 @@ static void usage(void)
int main(int argc, const char *argv[])
{
LogLevel = DEBUG_DEBUG;
DEBUGLEVEL = DEBUG_DEBUG;
if (getenv("CTDB_TEST_LOGLEVEL")) {
LogLevel = atoi(getenv("CTDB_TEST_LOGLEVEL"));
DEBUGLEVEL = atoi(getenv("CTDB_TEST_LOGLEVEL"));
}
if (argc < 2) {