MXS-421 Enable the turning on of events

This commit is contained in:
Johan Wikman 2018-06-14 14:09:52 +03:00
parent 6e3d3c0dcf
commit 6dd479104f
2 changed files with 33 additions and 13 deletions

View File

@ -92,7 +92,7 @@ const char* to_string(id_t id);
* @return True, if the string could be converted, false otherwise.
*/
bool from_string(id_t* pId, const char* zValue);
bool from_string(id_t* pId, const std::string& value)
inline bool from_string(id_t* pId, const std::string& value)
{
return from_string(pId, value.c_str());
}

View File

@ -49,6 +49,7 @@
#include <maxscale/version.h>
#include "internal/config.h"
#include "internal/event.hh"
#include "internal/filter.h"
#include "internal/modules.h"
#include "internal/monitor.h"
@ -1967,26 +1968,45 @@ handle_global_item(const char *name, const char *value)
}
else
{
bool found = false;
#ifndef SS_DEBUG
if (strcmp(name, "log_debug") == 0)
{
MXS_WARNING("The 'log_debug' option has no effect in release mode.");
found = true;
}
else
#endif
bool found = false;
for (i = 0; lognames[i].name; i++)
{
if (strcasecmp(name, lognames[i].name) == 0)
{
found = true;
if (lognames[i].replacement)
{
MXS_WARNING("In the configuration file the use of '%s' is deprecated, "
"use '%s' instead.",
lognames[i].name, lognames[i].replacement);
}
maxscale::event::result_t result = maxscale::event::configure(name, value);
mxs_log_set_priority_enabled(lognames[i].priority, config_truth_value(value));
switch (result)
{
case maxscale::event::ACCEPTED:
found = true;
break;
case maxscale::event::IGNORED:
for (i = 0; lognames[i].name; i++)
{
if (strcasecmp(name, lognames[i].name) == 0)
{
found = true;
if (lognames[i].replacement)
{
MXS_WARNING("In the configuration file the use of '%s' is deprecated, "
"use '%s' instead.",
lognames[i].name, lognames[i].replacement);
}
mxs_log_set_priority_enabled(lognames[i].priority, config_truth_value(value));
}
}
break;
case maxscale::event::INVALID:
// TODO: Should we bail out?
break;
}
}