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:
@ -55,8 +55,7 @@ bool mxs_log_init(const char* ident, const char* logdir, mxs_log_target_t target
|
|||||||
#define mxs_log_rotate mxb_log_rotate
|
#define mxs_log_rotate mxb_log_rotate
|
||||||
|
|
||||||
#define mxs_log_get_throttling mxb_log_get_throttling
|
#define mxs_log_get_throttling mxb_log_get_throttling
|
||||||
// TODO: Rename mxs_log_priority_is_enabled -> mxs_log_is_priority_enabled
|
#define mxs_log_is_priority_enabled mxb_log_is_priority_enabled
|
||||||
#define mxs_log_priority_is_enabled mxb_log_is_priority_enabled
|
|
||||||
#define mxs_log_set_augmentation mxb_log_set_augmentation
|
#define mxs_log_set_augmentation mxb_log_set_augmentation
|
||||||
#define mxs_log_set_highprecision_enabled mxb_log_set_highprecision_enabled
|
#define mxs_log_set_highprecision_enabled mxb_log_set_highprecision_enabled
|
||||||
#define mxs_log_set_maxlog_enabled mxb_log_set_maxlog_enabled
|
#define mxs_log_set_maxlog_enabled mxb_log_set_maxlog_enabled
|
||||||
@ -65,8 +64,6 @@ bool mxs_log_init(const char* ident, const char* logdir, mxs_log_target_t target
|
|||||||
#define mxs_log_set_syslog_enabled mxb_log_set_syslog_enabled
|
#define mxs_log_set_syslog_enabled mxb_log_set_syslog_enabled
|
||||||
#define mxs_log_set_throttling mxb_log_set_throttling
|
#define mxs_log_set_throttling mxb_log_set_throttling
|
||||||
|
|
||||||
#define MXS_LOG_PRIORITY_IS_ENABLED MXB_LOG_PRIORITY_IS_ENABLED
|
|
||||||
|
|
||||||
json_t* mxs_logs_to_json(const char* host);
|
json_t* mxs_logs_to_json(const char* host);
|
||||||
|
|
||||||
#define MXS_LOG_MESSAGE MXB_LOG_MESSAGE
|
#define MXS_LOG_MESSAGE MXB_LOG_MESSAGE
|
||||||
|
@ -747,7 +747,7 @@ static uint32_t resolve_query_type(parsing_info_t *pi, THD* thd)
|
|||||||
|
|
||||||
if (skygw_stmt_causes_implicit_commit(lex, &set_autocommit_stmt))
|
if (skygw_stmt_causes_implicit_commit(lex, &set_autocommit_stmt))
|
||||||
{
|
{
|
||||||
if (MXS_LOG_PRIORITY_IS_ENABLED(LOG_INFO))
|
if (mxs_log_is_priority_enabled(LOG_INFO))
|
||||||
{
|
{
|
||||||
if (sql_command_flags[lex->sql_command] &
|
if (sql_command_flags[lex->sql_command] &
|
||||||
CF_IMPLICT_COMMIT_BEGIN)
|
CF_IMPLICT_COMMIT_BEGIN)
|
||||||
@ -771,7 +771,7 @@ static uint32_t resolve_query_type(parsing_info_t *pi, THD* thd)
|
|||||||
|
|
||||||
if (set_autocommit_stmt == 0)
|
if (set_autocommit_stmt == 0)
|
||||||
{
|
{
|
||||||
if (MXS_LOG_PRIORITY_IS_ENABLED(LOG_INFO))
|
if (mxs_log_is_priority_enabled(LOG_INFO))
|
||||||
{
|
{
|
||||||
MXS_INFO("Disable autocommit : implicit START TRANSACTION"
|
MXS_INFO("Disable autocommit : implicit START TRANSACTION"
|
||||||
" before executing the next command.");
|
" before executing the next command.");
|
||||||
|
@ -4602,7 +4602,7 @@ static int32_t qc_sqlite_get_type_mask(GWBUF* pStmt, uint32_t* pType_mask)
|
|||||||
{
|
{
|
||||||
rv = QC_RESULT_OK;
|
rv = QC_RESULT_OK;
|
||||||
}
|
}
|
||||||
else if (MXS_LOG_PRIORITY_IS_ENABLED(LOG_INFO))
|
else if (mxs_log_is_priority_enabled(LOG_INFO))
|
||||||
{
|
{
|
||||||
log_invalid_data(pStmt, "cannot report query type");
|
log_invalid_data(pStmt, "cannot report query type");
|
||||||
}
|
}
|
||||||
@ -4631,7 +4631,7 @@ static int32_t qc_sqlite_get_operation(GWBUF* pStmt, int32_t* pOp)
|
|||||||
{
|
{
|
||||||
rv = QC_RESULT_OK;
|
rv = QC_RESULT_OK;
|
||||||
}
|
}
|
||||||
else if (MXS_LOG_PRIORITY_IS_ENABLED(LOG_INFO))
|
else if (mxs_log_is_priority_enabled(LOG_INFO))
|
||||||
{
|
{
|
||||||
log_invalid_data(pStmt, "cannot report query operation");
|
log_invalid_data(pStmt, "cannot report query operation");
|
||||||
}
|
}
|
||||||
@ -4660,7 +4660,7 @@ static int32_t qc_sqlite_get_created_table_name(GWBUF* pStmt, char** pzCreated_t
|
|||||||
{
|
{
|
||||||
rv = QC_RESULT_OK;
|
rv = QC_RESULT_OK;
|
||||||
}
|
}
|
||||||
else if (MXS_LOG_PRIORITY_IS_ENABLED(LOG_INFO))
|
else if (mxs_log_is_priority_enabled(LOG_INFO))
|
||||||
{
|
{
|
||||||
log_invalid_data(pStmt, "cannot report created tables");
|
log_invalid_data(pStmt, "cannot report created tables");
|
||||||
}
|
}
|
||||||
@ -4689,7 +4689,7 @@ static int32_t qc_sqlite_is_drop_table_query(GWBUF* pStmt, int32_t* pIs_drop_tab
|
|||||||
{
|
{
|
||||||
rv = QC_RESULT_OK;
|
rv = QC_RESULT_OK;
|
||||||
}
|
}
|
||||||
else if (MXS_LOG_PRIORITY_IS_ENABLED(LOG_INFO))
|
else if (mxs_log_is_priority_enabled(LOG_INFO))
|
||||||
{
|
{
|
||||||
log_invalid_data(pStmt, "cannot report whether query is drop table");
|
log_invalid_data(pStmt, "cannot report whether query is drop table");
|
||||||
}
|
}
|
||||||
@ -4722,7 +4722,7 @@ static int32_t qc_sqlite_get_table_names(GWBUF* pStmt,
|
|||||||
{
|
{
|
||||||
rv = QC_RESULT_OK;
|
rv = QC_RESULT_OK;
|
||||||
}
|
}
|
||||||
else if (MXS_LOG_PRIORITY_IS_ENABLED(LOG_INFO))
|
else if (mxs_log_is_priority_enabled(LOG_INFO))
|
||||||
{
|
{
|
||||||
log_invalid_data(pStmt, "cannot report what tables are accessed");
|
log_invalid_data(pStmt, "cannot report what tables are accessed");
|
||||||
}
|
}
|
||||||
@ -4765,7 +4765,7 @@ static int32_t qc_sqlite_query_has_clause(GWBUF* pStmt, int32_t* pHas_clause)
|
|||||||
{
|
{
|
||||||
rv = QC_RESULT_OK;
|
rv = QC_RESULT_OK;
|
||||||
}
|
}
|
||||||
else if (MXS_LOG_PRIORITY_IS_ENABLED(LOG_INFO))
|
else if (mxs_log_is_priority_enabled(LOG_INFO))
|
||||||
{
|
{
|
||||||
log_invalid_data(pStmt, "cannot report whether the query has a where clause");
|
log_invalid_data(pStmt, "cannot report whether the query has a where clause");
|
||||||
}
|
}
|
||||||
@ -4795,7 +4795,7 @@ static int32_t qc_sqlite_get_database_names(GWBUF* pStmt, char*** ppzDatabase_na
|
|||||||
{
|
{
|
||||||
rv = QC_RESULT_OK;
|
rv = QC_RESULT_OK;
|
||||||
}
|
}
|
||||||
else if (MXS_LOG_PRIORITY_IS_ENABLED(LOG_INFO))
|
else if (mxs_log_is_priority_enabled(LOG_INFO))
|
||||||
{
|
{
|
||||||
log_invalid_data(pStmt, "cannot report what databases are accessed");
|
log_invalid_data(pStmt, "cannot report what databases are accessed");
|
||||||
}
|
}
|
||||||
@ -4824,7 +4824,7 @@ static int32_t qc_sqlite_get_prepare_name(GWBUF* pStmt, char** pzPrepare_name)
|
|||||||
{
|
{
|
||||||
rv = QC_RESULT_OK;
|
rv = QC_RESULT_OK;
|
||||||
}
|
}
|
||||||
else if (MXS_LOG_PRIORITY_IS_ENABLED(LOG_INFO))
|
else if (mxs_log_is_priority_enabled(LOG_INFO))
|
||||||
{
|
{
|
||||||
log_invalid_data(pStmt, "cannot report the name of a prepared statement");
|
log_invalid_data(pStmt, "cannot report the name of a prepared statement");
|
||||||
}
|
}
|
||||||
@ -4855,7 +4855,7 @@ int32_t qc_sqlite_get_field_info(GWBUF* pStmt, const QC_FIELD_INFO** ppInfos, ui
|
|||||||
{
|
{
|
||||||
rv = QC_RESULT_OK;
|
rv = QC_RESULT_OK;
|
||||||
}
|
}
|
||||||
else if (MXS_LOG_PRIORITY_IS_ENABLED(LOG_INFO))
|
else if (mxs_log_is_priority_enabled(LOG_INFO))
|
||||||
{
|
{
|
||||||
log_invalid_data(pStmt, "cannot report field info");
|
log_invalid_data(pStmt, "cannot report field info");
|
||||||
}
|
}
|
||||||
@ -4886,7 +4886,7 @@ int32_t qc_sqlite_get_function_info(GWBUF* pStmt, const QC_FUNCTION_INFO** ppInf
|
|||||||
{
|
{
|
||||||
rv = QC_RESULT_OK;
|
rv = QC_RESULT_OK;
|
||||||
}
|
}
|
||||||
else if (MXS_LOG_PRIORITY_IS_ENABLED(LOG_INFO))
|
else if (mxs_log_is_priority_enabled(LOG_INFO))
|
||||||
{
|
{
|
||||||
log_invalid_data(pStmt, "cannot report function info");
|
log_invalid_data(pStmt, "cannot report function info");
|
||||||
}
|
}
|
||||||
@ -4916,7 +4916,7 @@ int32_t qc_sqlite_get_preparable_stmt(GWBUF* pStmt, GWBUF** pzPreparable_stmt)
|
|||||||
{
|
{
|
||||||
rv = QC_RESULT_OK;
|
rv = QC_RESULT_OK;
|
||||||
}
|
}
|
||||||
else if (MXS_LOG_PRIORITY_IS_ENABLED(LOG_INFO))
|
else if (mxs_log_is_priority_enabled(LOG_INFO))
|
||||||
{
|
{
|
||||||
log_invalid_data(pStmt, "cannot report preperable statement");
|
log_invalid_data(pStmt, "cannot report preperable statement");
|
||||||
}
|
}
|
||||||
|
@ -63,27 +63,32 @@ json_t* get_log_priorities()
|
|||||||
{
|
{
|
||||||
json_t* arr = json_array();
|
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"));
|
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"));
|
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"));
|
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"));
|
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"));
|
json_array_append_new(arr, json_string("debug"));
|
||||||
}
|
}
|
||||||
|
@ -143,7 +143,7 @@ void mxs_pcre2_print_error(int errorcode, const char *module_name, const char *f
|
|||||||
{
|
{
|
||||||
ss_dassert(filename);
|
ss_dassert(filename);
|
||||||
ss_dassert(func_name);
|
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.
|
// 120 should be enough to contain any error message according to pcre2 manual.
|
||||||
const PCRE2_SIZE errbuf_len = 120;
|
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)
|
if (result == PCRE2_ERROR_NOMATCH)
|
||||||
{
|
{
|
||||||
rval = false; // Didn't match the "match"-regex
|
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__,
|
mxs_log_message(LOG_INFO, calling_module, __FILE__, __LINE__, __func__,
|
||||||
"Subject does not match the 'match' pattern: %.*s",
|
"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)
|
if (result >= 0)
|
||||||
{
|
{
|
||||||
rval = false; // Matched the "exclude"-regex
|
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__,
|
mxs_log_message(LOG_INFO, calling_module, __FILE__, __LINE__, __func__,
|
||||||
"Query matches the 'exclude' pattern: %.*s",
|
"Query matches the 'exclude' pattern: %.*s",
|
||||||
|
@ -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);
|
log_transaction_status(pBuffer, type_mask);
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ int ssl_authenticate_client(DCB *dcb, bool is_capable)
|
|||||||
user, remote, service);
|
user, remote, service);
|
||||||
return SSL_ERROR_ACCEPT_FAILED;
|
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)
|
if (1 == return_code)
|
||||||
{
|
{
|
||||||
|
@ -636,7 +636,7 @@ routeQuery(MXS_ROUTER *instance, MXS_ROUTER_SESSION *router_session, GWBUF *queu
|
|||||||
queue);
|
queue);
|
||||||
break;
|
break;
|
||||||
case MXS_COM_QUERY:
|
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);
|
trc = modutil_get_SQL(queue);
|
||||||
}
|
}
|
||||||
|
@ -314,7 +314,7 @@ bool RWSplit::select_connect_backend_servers(MXS_SESSION *session,
|
|||||||
auto cmpfun = criteria_cmpfun[select_criteria];
|
auto cmpfun = criteria_cmpfun[select_criteria];
|
||||||
ss_dassert(cmpfun);
|
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);
|
log_server_connections(select_criteria, backends);
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ public:
|
|||||||
{
|
{
|
||||||
ss_info_dassert(buf, "Trx::add_stmt: Buffer must not be empty");
|
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());
|
MXS_INFO("Adding to trx: %s", mxs::extract_sql(buf, 512).c_str());
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,7 @@ bool connect_backend_servers(SSRBackendList& backends, MXS_SESSION* session)
|
|||||||
int servers_connected = 0;
|
int servers_connected = 0;
|
||||||
int slaves_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:");
|
MXS_INFO("Servers and connection counts:");
|
||||||
|
|
||||||
@ -164,7 +164,7 @@ bool connect_backend_servers(SSRBackendList& backends, MXS_SESSION* session)
|
|||||||
{
|
{
|
||||||
succp = true;
|
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++)
|
for (SSRBackendList::iterator it = backends.begin(); it != backends.end(); it++)
|
||||||
{
|
{
|
||||||
|
@ -182,7 +182,7 @@ static void inspect_query(GWBUF* pPacket, uint32_t* type, qc_query_op_t* op, uin
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MXS_LOG_PRIORITY_IS_ENABLED(LOG_INFO))
|
if (mxs_log_is_priority_enabled(LOG_INFO))
|
||||||
{
|
{
|
||||||
char *sql;
|
char *sql;
|
||||||
int sql_len;
|
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);
|
(*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",
|
MXS_INFO("Route query to %s\t%s:%d",
|
||||||
server_is_master((*it)->backend()->server) ? "master" : "slave",
|
server_is_master((*it)->backend()->server) ? "master" : "slave",
|
||||||
|
Reference in New Issue
Block a user