Remove deprecated logging functionality
This commit is contained in:
@ -612,12 +612,8 @@ struct subcommand reloadoptions[] =
|
|||||||
{ EMPTY_OPTION }
|
{ EMPTY_OPTION }
|
||||||
};
|
};
|
||||||
|
|
||||||
static void enable_log_action(DCB *, char *);
|
|
||||||
static void disable_log_action(DCB *, char *);
|
|
||||||
static void enable_log_priority(DCB *, char *);
|
static void enable_log_priority(DCB *, char *);
|
||||||
static void disable_log_priority(DCB *, char *);
|
static void disable_log_priority(DCB *, char *);
|
||||||
static void enable_sess_log_action(DCB *dcb, char *arg1, char *arg2);
|
|
||||||
static void disable_sess_log_action(DCB *dcb, char *arg1, char *arg2);
|
|
||||||
static void enable_sess_log_priority(DCB *dcb, char *arg1, char *arg2);
|
static void enable_sess_log_priority(DCB *dcb, char *arg1, char *arg2);
|
||||||
static void disable_sess_log_priority(DCB *dcb, char *arg1, char *arg2);
|
static void disable_sess_log_priority(DCB *dcb, char *arg1, char *arg2);
|
||||||
static void enable_service_root(DCB *dcb, SERVICE *service);
|
static void enable_service_root(DCB *dcb, SERVICE *service);
|
||||||
@ -636,14 +632,6 @@ static void disable_account(DCB *, char *user);
|
|||||||
* */
|
* */
|
||||||
struct subcommand enableoptions[] =
|
struct subcommand enableoptions[] =
|
||||||
{
|
{
|
||||||
{
|
|
||||||
"log",
|
|
||||||
1, 1,
|
|
||||||
enable_log_action,
|
|
||||||
"[deprecated] Enable a logging level",
|
|
||||||
"Options 'trace' | 'error' | 'message'. E.g. 'enable log message'.",
|
|
||||||
{ARG_TYPE_STRING, 0, 0}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"log-priority",
|
"log-priority",
|
||||||
1, 1,
|
1, 1,
|
||||||
@ -654,15 +642,6 @@ struct subcommand enableoptions[] =
|
|||||||
"E.g.: 'enable log-priority info'.",
|
"E.g.: 'enable log-priority info'.",
|
||||||
{ARG_TYPE_STRING, 0, 0}
|
{ARG_TYPE_STRING, 0, 0}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"sessionlog",
|
|
||||||
2, 2,
|
|
||||||
enable_sess_log_action,
|
|
||||||
"[deprecated] Enable a logging level for a single session",
|
|
||||||
"Usage: enable sessionlog [trace | error | "
|
|
||||||
"message | debug] <session id>\t E.g. enable sessionlog message 123.",
|
|
||||||
{ARG_TYPE_STRING, ARG_TYPE_STRING, 0}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"sessionlog-priority",
|
"sessionlog-priority",
|
||||||
2, 2,
|
2, 2,
|
||||||
@ -725,15 +704,6 @@ struct subcommand enableoptions[] =
|
|||||||
* */
|
* */
|
||||||
struct subcommand disableoptions[] =
|
struct subcommand disableoptions[] =
|
||||||
{
|
{
|
||||||
{
|
|
||||||
"log",
|
|
||||||
1, 1,
|
|
||||||
disable_log_action,
|
|
||||||
"[deprecated] Disable log for MaxScale",
|
|
||||||
"Options: 'debug' | 'trace' | 'error' | 'message'."
|
|
||||||
"E.g. 'disable log debug'",
|
|
||||||
{ARG_TYPE_STRING, 0, 0}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"log-priority",
|
"log-priority",
|
||||||
1, 1,
|
1, 1,
|
||||||
@ -743,15 +713,6 @@ struct subcommand disableoptions[] =
|
|||||||
"E.g.: 'disable log-priority info'",
|
"E.g.: 'disable log-priority info'",
|
||||||
{ARG_TYPE_STRING, 0, 0}
|
{ARG_TYPE_STRING, 0, 0}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"sessionlog",
|
|
||||||
2, 2,
|
|
||||||
disable_sess_log_action,
|
|
||||||
"[deprecated] Disable log options",
|
|
||||||
"Disable Log options for a single session. Usage: disable sessionlog [trace | error | "
|
|
||||||
"message | debug] <session id>\t E.g. disable sessionlog message 123",
|
|
||||||
{ARG_TYPE_STRING, ARG_TYPE_STRING, 0}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"sessionlog-priority",
|
"sessionlog-priority",
|
||||||
2, 2,
|
2, 2,
|
||||||
@ -2089,34 +2050,6 @@ struct log_action_entry
|
|||||||
const char* replacement;
|
const char* replacement;
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool get_log_action(const char* name, struct log_action_entry* entryp)
|
|
||||||
{
|
|
||||||
static const struct log_action_entry entries[] =
|
|
||||||
{
|
|
||||||
{ "debug", LOG_DEBUG, "debug" },
|
|
||||||
{ "trace", LOG_INFO, "info" },
|
|
||||||
{ "message", LOG_NOTICE, "notice" },
|
|
||||||
};
|
|
||||||
const int n_entries = sizeof(entries) / sizeof(entries[0]);
|
|
||||||
|
|
||||||
bool found = false;
|
|
||||||
int i = 0;
|
|
||||||
|
|
||||||
while (!found && (i < n_entries))
|
|
||||||
{
|
|
||||||
if (strcmp(name, entries[i].name) == 0)
|
|
||||||
{
|
|
||||||
*entryp = entries[i];
|
|
||||||
found = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
|
|
||||||
return found;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool seslog_cb(DCB *dcb, void *data)
|
bool seslog_cb(DCB *dcb, void *data)
|
||||||
{
|
{
|
||||||
bool rval = true;
|
bool rval = true;
|
||||||
@ -2141,58 +2074,6 @@ bool seslog_cb(DCB *dcb, void *data)
|
|||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Enables a log for a single session
|
|
||||||
* @param session The session in question
|
|
||||||
* @param dcb Client DCB
|
|
||||||
* @param type Which log to enable
|
|
||||||
*/
|
|
||||||
static void enable_sess_log_action(DCB *dcb, char *arg1, char *arg2)
|
|
||||||
{
|
|
||||||
struct log_action_entry entry;
|
|
||||||
|
|
||||||
if (get_log_action(arg1, &entry))
|
|
||||||
{
|
|
||||||
size_t id = (size_t)strtol(arg2, NULL, 10);
|
|
||||||
void *data[] = {&entry, &id, (void*)true};
|
|
||||||
|
|
||||||
if (dcb_foreach(seslog_cb, data))
|
|
||||||
{
|
|
||||||
dcb_printf(dcb, "Session not found: %s.\n", arg2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dcb_printf(dcb, "%s is not supported for enable log.\n", arg1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Disables a log for a single session
|
|
||||||
* @param session The session in question
|
|
||||||
* @param dcb Client DCB
|
|
||||||
* @param type Which log to disable
|
|
||||||
*/
|
|
||||||
static void disable_sess_log_action(DCB *dcb, char *arg1, char *arg2)
|
|
||||||
{
|
|
||||||
struct log_action_entry entry;
|
|
||||||
|
|
||||||
if (get_log_action(arg1, &entry))
|
|
||||||
{
|
|
||||||
size_t id = (size_t)strtol(arg2, NULL, 10);
|
|
||||||
void *data[] = {&entry, &id, (void*)false};
|
|
||||||
|
|
||||||
if (dcb_foreach(seslog_cb, data))
|
|
||||||
{
|
|
||||||
dcb_printf(dcb, "Session not found: %s.\n", arg2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dcb_printf(dcb, "%s is not supported for enable log.\n", arg1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct log_priority_entry
|
struct log_priority_entry
|
||||||
{
|
{
|
||||||
const char* name;
|
const char* name;
|
||||||
@ -2306,48 +2187,6 @@ static void disable_sess_log_priority(DCB *dcb, char *arg1, char *arg2)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* The log enable action
|
|
||||||
*/
|
|
||||||
static void enable_log_action(DCB *dcb, char *arg1)
|
|
||||||
{
|
|
||||||
struct log_action_entry entry;
|
|
||||||
|
|
||||||
if (get_log_action(arg1, &entry))
|
|
||||||
{
|
|
||||||
mxs_log_set_priority_enabled(entry.priority, true);
|
|
||||||
|
|
||||||
dcb_printf(dcb,
|
|
||||||
"'enable log %s' is accepted but deprecated, use 'enable log-priority %s' instead.\n",
|
|
||||||
arg1, entry.replacement);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dcb_printf(dcb, "'%s' is not supported for enable log.\n", arg1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The log disable action
|
|
||||||
*/
|
|
||||||
static void disable_log_action(DCB *dcb, char *arg1)
|
|
||||||
{
|
|
||||||
struct log_action_entry entry;
|
|
||||||
|
|
||||||
if (get_log_action(arg1, &entry))
|
|
||||||
{
|
|
||||||
mxs_log_set_priority_enabled(entry.priority, false);
|
|
||||||
|
|
||||||
dcb_printf(dcb,
|
|
||||||
"'disable log %s' is accepted but deprecated, use 'enable log-priority %s' instead.\n",
|
|
||||||
arg1, entry.replacement);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dcb_printf(dcb, "'%s' is not supported for 'disable log'.\n", arg1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The log-priority enable action
|
* The log-priority enable action
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user