Log: Another step in the move from logfiles to priorities.
skygw_[enable|disable]_log has now been removed from the external interface and priorities must instead be set using mxs_log_set_priority_enabled(int priority, bool enabled). A bitmask is already being updated, but internally and as used by the LOG_IF macros, the actual enabling is still made using logfile ids. The configuration entries have been replaced as follows: log_messages -> log_notice log_trace -> log_info The old ones can be used, but cause a warning to be logged. Similarily the maxadmin commands have been updated. "[enable|disable] log ..." works as expected, but there will be a message about it being deprecated. Instead there is now a [enable|disable] log-priority err|warning|notice|info|debug command that should be used instead.
This commit is contained in:
@ -62,6 +62,38 @@ const int N_THR = 4;
|
||||
#define TEST_ERROR(msg)\
|
||||
do { fprintf(stderr, "[%s:%d]: %s\n", basename(__FILE__), __LINE__, msg); } while (false)
|
||||
|
||||
static logfile_id_t id_to_priority(logfile_id_t id)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case LOGFILE_ERROR:
|
||||
return LOG_ERR;
|
||||
|
||||
case LOGFILE_MESSAGE:
|
||||
return LOG_NOTICE;
|
||||
|
||||
case LOGFILE_TRACE:
|
||||
return LOG_INFO;
|
||||
|
||||
case LOGFILE_DEBUG:
|
||||
return LOG_DEBUG;
|
||||
|
||||
default:
|
||||
assert(!true);
|
||||
return LOG_ERR;
|
||||
}
|
||||
}
|
||||
|
||||
static void skygw_log_enable(logfile_id_t id)
|
||||
{
|
||||
mxs_log_set_priority_enabled(id_to_priority(id), true);
|
||||
}
|
||||
|
||||
static void skygw_log_disable(logfile_id_t id)
|
||||
{
|
||||
mxs_log_set_priority_enabled(id_to_priority(id), false);
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int err = 0;
|
||||
|
Reference in New Issue
Block a user