MXS-2014 Remove duplicate function

Two functions that essentially did the same thing, but had
slightly different name.
This commit is contained in:
Johan Wikman 2018-08-15 15:29:43 +03:00
parent b4912a942f
commit 52e6e10e28
2 changed files with 7 additions and 32 deletions

View File

@ -129,7 +129,11 @@ bool mxb_log_set_priority_enabled(int priority, bool enabled);
*
* @return True if enabled, false otherwise.
*/
bool mxs_log_is_priority_enabled(int priority);
static inline bool mxb_log_is_priority_enabled(int priority)
{
assert((priority & ~LOG_PRIMASK) == 0);
return MXB_LOG_PRIORITY_IS_ENABLED(priority) || priority == LOG_ALERT;
}
/**
* Enable/disable syslog logging.
@ -178,12 +182,6 @@ void mxb_log_set_throttling(const MXB_LOG_THROTTLING* throttling);
void mxb_log_get_throttling(MXB_LOG_THROTTLING* throttling);
static inline bool mxb_log_priority_is_enabled(int priority)
{
assert((priority & ~LOG_PRIMASK) == 0);
return MXB_LOG_PRIORITY_IS_ENABLED(priority) || priority == LOG_ALERT;
}
int mxb_log_message(int priority,
const char* modname,
const char* file, int line, const char* function,
@ -199,7 +197,7 @@ int mxb_log_message(int priority,
* MXB_ERROR, MXB_WARNING, etc. macros instead.
*/
#define MXB_LOG_MESSAGE(priority, format, ...)\
(mxb_log_priority_is_enabled(priority) ? \
(mxb_log_is_priority_enabled(priority) ? \
mxb_log_message(priority, MXB_MODULE_NAME, __FILE__, __LINE__, __func__, format, ##__VA_ARGS__) :\
0)

View File

@ -16,15 +16,13 @@
#include <sys/time.h>
#include <syslog.h>
#include <cerrno>
#include <cinttypes>
#include <cmath>
#include <cstring>
#include <string>
#include <mutex>
#include <unordered_map>
#include <maxbase/atomic.h>
#include <maxbase/error.h>
#include <maxbase/logger.hh>
#define CALCLEN(i) ((size_t)(floor(log10(abs((int64_t)i))) + 1))
@ -605,27 +603,6 @@ bool mxb_log_set_priority_enabled(int level, bool enable)
return rv;
}
bool mxb_log_is_priority_enabled(int level)
{
bool rv = false;
if ((level & ~LOG_PRIMASK) == 0)
{
int bit = (1 << level);
if (mxb_log_enabled_priorities & bit)
{
rv = true;
}
}
else
{
MXB_ERROR("Attempt to query unknown syslog priority %d.", level);
}
return rv;
}
typedef struct log_prefix
{
const char* text; // The prefix, e.g. "error: "