MXS-2014 Rename mxs_log_priority_is_enabled

- Renamed to mxs_log_is_priority_enabled
- That function instead of the macro is now consistently used
This commit is contained in:
Johan Wikman
2018-08-15 21:48:38 +03:00
parent 8ae2997c4e
commit 9a8bb95be6
12 changed files with 36 additions and 34 deletions

View File

@ -63,27 +63,32 @@ json_t* get_log_priorities()
{
json_t* arr = json_array();
if (MXS_LOG_PRIORITY_IS_ENABLED(LOG_ERR))
if (mxb_log_is_priority_enabled(LOG_ALERT))
{
json_array_append_new(arr, json_string("alert"));
}
if (mxb_log_is_priority_enabled(LOG_ERR))
{
json_array_append_new(arr, json_string("error"));
}
if (MXS_LOG_PRIORITY_IS_ENABLED(LOG_WARNING))
if (mxb_log_is_priority_enabled(LOG_WARNING))
{
json_array_append_new(arr, json_string("warning"));
}
if (MXS_LOG_PRIORITY_IS_ENABLED(LOG_NOTICE))
if (mxb_log_is_priority_enabled(LOG_NOTICE))
{
json_array_append_new(arr, json_string("notice"));
}
if (MXS_LOG_PRIORITY_IS_ENABLED(LOG_INFO))
if (mxb_log_is_priority_enabled(LOG_INFO))
{
json_array_append_new(arr, json_string("info"));
}
if (MXS_LOG_PRIORITY_IS_ENABLED(LOG_DEBUG))
if (mxb_log_is_priority_enabled(LOG_DEBUG))
{
json_array_append_new(arr, json_string("debug"));
}

View File

@ -143,7 +143,7 @@ void mxs_pcre2_print_error(int errorcode, const char *module_name, const char *f
{
ss_dassert(filename);
ss_dassert(func_name);
if (mxs_log_priority_is_enabled(LOG_ERR))
if (mxs_log_is_priority_enabled(LOG_ERR))
{
// 120 should be enough to contain any error message according to pcre2 manual.
const PCRE2_SIZE errbuf_len = 120;
@ -167,7 +167,7 @@ bool mxs_pcre2_check_match_exclude(pcre2_code* re_match, pcre2_code* re_exclude,
if (result == PCRE2_ERROR_NOMATCH)
{
rval = false; // Didn't match the "match"-regex
if (mxs_log_priority_is_enabled(LOG_INFO))
if (mxs_log_is_priority_enabled(LOG_INFO))
{
mxs_log_message(LOG_INFO, calling_module, __FILE__, __LINE__, __func__,
"Subject does not match the 'match' pattern: %.*s",
@ -188,7 +188,7 @@ bool mxs_pcre2_check_match_exclude(pcre2_code* re_match, pcre2_code* re_exclude,
if (result >= 0)
{
rval = false; // Matched the "exclude"-regex
if (mxs_log_priority_is_enabled(LOG_INFO))
if (mxs_log_is_priority_enabled(LOG_INFO))
{
mxs_log_message(LOG_INFO, calling_module, __FILE__, __LINE__, __func__,
"Query matches the 'exclude' pattern: %.*s",

View File

@ -897,7 +897,7 @@ QueryClassifier::update_route_info(QueryClassifier::current_target_t current_tar
}
}
if (MXS_LOG_PRIORITY_IS_ENABLED(LOG_INFO))
if (mxs_log_is_priority_enabled(LOG_INFO))
{
log_transaction_status(pBuffer, type_mask);
}

View File

@ -91,7 +91,7 @@ int ssl_authenticate_client(DCB *dcb, bool is_capable)
user, remote, service);
return SSL_ERROR_ACCEPT_FAILED;
}
else if (MXS_LOG_PRIORITY_IS_ENABLED(LOG_INFO))
else if (mxs_log_is_priority_enabled(LOG_INFO))
{
if (1 == return_code)
{

View File

@ -636,7 +636,7 @@ routeQuery(MXS_ROUTER *instance, MXS_ROUTER_SESSION *router_session, GWBUF *queu
queue);
break;
case MXS_COM_QUERY:
if (MXS_LOG_PRIORITY_IS_ENABLED(LOG_INFO))
if (mxs_log_is_priority_enabled(LOG_INFO))
{
trc = modutil_get_SQL(queue);
}

View File

@ -314,7 +314,7 @@ bool RWSplit::select_connect_backend_servers(MXS_SESSION *session,
auto cmpfun = criteria_cmpfun[select_criteria];
ss_dassert(cmpfun);
if (MXS_LOG_PRIORITY_IS_ENABLED(LOG_INFO))
if (mxs_log_is_priority_enabled(LOG_INFO))
{
log_server_connections(select_criteria, backends);
}

View File

@ -41,7 +41,7 @@ public:
{
ss_info_dassert(buf, "Trx::add_stmt: Buffer must not be empty");
if (MXS_LOG_PRIORITY_IS_ENABLED(LOG_INFO))
if (mxs_log_is_priority_enabled(LOG_INFO))
{
MXS_INFO("Adding to trx: %s", mxs::extract_sql(buf, 512).c_str());
}

View File

@ -106,7 +106,7 @@ bool connect_backend_servers(SSRBackendList& backends, MXS_SESSION* session)
int servers_connected = 0;
int slaves_connected = 0;
if (MXS_LOG_PRIORITY_IS_ENABLED(LOG_INFO))
if (mxs_log_is_priority_enabled(LOG_INFO))
{
MXS_INFO("Servers and connection counts:");
@ -164,7 +164,7 @@ bool connect_backend_servers(SSRBackendList& backends, MXS_SESSION* session)
{
succp = true;
if (MXS_LOG_PRIORITY_IS_ENABLED(LOG_INFO))
if (mxs_log_is_priority_enabled(LOG_INFO))
{
for (SSRBackendList::iterator it = backends.begin(); it != backends.end(); it++)
{

View File

@ -182,7 +182,7 @@ static void inspect_query(GWBUF* pPacket, uint32_t* type, qc_query_op_t* op, uin
break;
}
if (MXS_LOG_PRIORITY_IS_ENABLED(LOG_INFO))
if (mxs_log_is_priority_enabled(LOG_INFO))
{
char *sql;
int sql_len;
@ -755,7 +755,7 @@ bool SchemaRouterSession::route_session_write(GWBUF* querybuf, uint8_t command)
(*it)->append_session_command(buffer, m_sent_sescmd);
if (MXS_LOG_PRIORITY_IS_ENABLED(LOG_INFO))
if (mxs_log_is_priority_enabled(LOG_INFO))
{
MXS_INFO("Route query to %s\t%s:%d",
server_is_master((*it)->backend()->server) ? "master" : "slave",