ctdb->log->buf_used += n;
}
+ this_log_level = script_log_level;
+
while (ctdb->log->buf_used > 0 &&
(p = memchr(ctdb->log->buf, '\n', ctdb->log->buf_used)) != NULL) {
int n1 = (p - ctdb->log->buf)+1;
if (n2 > 0 && ctdb->log->buf[n2-1] == '\r') {
n2--;
}
- do_debug("%*.*s\n", n2, n2, ctdb->log->buf);
+ if (script_log_level <= LogLevel) {
+ do_debug("%*.*s\n", n2, n2, ctdb->log->buf);
+ }
memmove(ctdb->log->buf, p+1, sizeof(ctdb->log->buf) - n1);
ctdb->log->buf_used -= n1;
}
/* the buffer could have completely filled - unfortunately we have
no choice but to dump it out straight away */
if (ctdb->log->buf_used == sizeof(ctdb->log->buf)) {
- do_debug("%*.*s\n",
- (int)ctdb->log->buf_used, (int)ctdb->log->buf_used, ctdb->log->buf);
+ if (script_log_level <= LogLevel) {
+ do_debug("%*.*s\n",
+ (int)ctdb->log->buf_used, (int)ctdb->log->buf_used, ctdb->log->buf);
+ }
ctdb->log->buf_used = 0;
}
}
int no_lmaster;
int no_recmaster;
int lvs;
+ int script_log_level;
} options = {
.nlist = ETCDIR "/ctdb/nodes",
.transport = "tcp",
.logfile = VARDIR "/log/log.ctdb",
.db_dir = VARDIR "/ctdb",
.db_dir_persistent = VARDIR "/ctdb/persistent",
+ .script_log_level = DEBUG_ERR,
};
+int script_log_level;
/*
called by the transport layer when a packet comes in
{ "no-lmaster", 0, POPT_ARG_NONE, &options.no_lmaster, 0, "disable lmaster role on this node", NULL },
{ "no-recmaster", 0, POPT_ARG_NONE, &options.no_recmaster, 0, "disable recmaster role on this node", NULL },
{ "lvs", 0, POPT_ARG_NONE, &options.lvs, 0, "lvs is enabled on this node", NULL },
+ { "script-log-level", 0, POPT_ARG_INT, &options.script_log_level, DEBUG_ERR, "log level of event script output", NULL },
POPT_TABLEEND
};
int opt, ret;
ctdb->start_as_disabled = options.start_as_disabled;
+ script_log_level = options.script_log_level;
+
ret = ctdb_set_logfile(ctdb, options.logfile, options.use_syslog);
if (ret == -1) {
printf("ctdb_set_logfile to %s failed - %s\n",