misc
This commit is contained in:
+2
-1
@@ -20,11 +20,12 @@ USR_CXXFLAGS += -fvisibility=hidden -fvisibility-inlines-hidden
|
||||
#USR_CXXFLAGS_Linux += -gz=zlib
|
||||
#USR_LDFLAGS_Linux += -Wl,--compress-debug-sections=zlib
|
||||
|
||||
# LTO takes a nice chunk out of the .so text size, but blows up the .a
|
||||
# LTO takes a nice chunk out of the .so text size, but blows up the .a size
|
||||
#USR_CXXFLAGS += -flto
|
||||
#USR_LDFLAGS += -flto
|
||||
|
||||
# fault on any undefined symbols (eg. from missing LIB_SYS_LIBS)
|
||||
# breaks on older ncurses (circa RHEL6) not using the INPUT() trick to pull in libtinfo.so
|
||||
USR_LDFLAGS_Linux += -Wl,--no-undefined -Wl,--no-allow-shlib-undefined
|
||||
|
||||
endif
|
||||
|
||||
+13
-11
@@ -29,8 +29,9 @@
|
||||
|
||||
typedef epicsGuard<epicsMutex> Guard;
|
||||
|
||||
namespace pvxs {
|
||||
|
||||
namespace {
|
||||
using namespace pvxs;
|
||||
|
||||
DEFINE_LOGGER(logerr, "pvxs.ev");
|
||||
|
||||
@@ -150,9 +151,7 @@ void logger_prepare(void *unused)
|
||||
logger_gbl = new logger_gbl_t;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace pvxs {
|
||||
} // namespace
|
||||
|
||||
int logger::init()
|
||||
{
|
||||
@@ -174,11 +173,9 @@ int logger::init()
|
||||
return lvl;
|
||||
}
|
||||
|
||||
void xerrlogHexPrintf(const void *buf, size_t buflen,
|
||||
const char *fmt, ...)
|
||||
void xerrlogHexPrintf(const void *buf, size_t buflen)
|
||||
{
|
||||
const uint8_t* const cbuf = static_cast<const uint8_t*>(buf);
|
||||
va_list args;
|
||||
|
||||
// whole buffer
|
||||
for(size_t pos=0; pos<buflen;)
|
||||
@@ -209,10 +206,6 @@ void xerrlogHexPrintf(const void *buf, size_t buflen,
|
||||
|
||||
errlogPrintf("%04x : %s %s %s %s\n", addr, buf[0], buf[1], buf[2], buf[3]);
|
||||
}
|
||||
|
||||
va_start(args, fmt);
|
||||
errlogVprintf(fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void logger_level_set(const char *name, int lvl)
|
||||
@@ -224,6 +217,15 @@ void logger_level_set(const char *name, int lvl)
|
||||
logger_gbl->set(name, lvl);
|
||||
}
|
||||
|
||||
void logger_level_clear()
|
||||
{
|
||||
epicsThreadOnce(&logger_once, &logger_prepare, nullptr);
|
||||
assert(logger_gbl);
|
||||
|
||||
Guard G(logger_gbl->lock);
|
||||
logger_gbl->config.clear();
|
||||
}
|
||||
|
||||
void logger_config_env()
|
||||
{
|
||||
const char *env = getenv("PVXS_LOG");
|
||||
|
||||
+10
-4
@@ -26,7 +26,7 @@ enum struct Level {
|
||||
};
|
||||
|
||||
struct logger {
|
||||
const char *name;
|
||||
const char * const name;
|
||||
std::atomic<int> lvl;
|
||||
constexpr logger(const char *name) :name(name), lvl{-1} {}
|
||||
|
||||
@@ -47,8 +47,7 @@ public:
|
||||
#define DEFINE_LOGGER(VAR, NAME) static ::pvxs::logger VAR{NAME}
|
||||
|
||||
PVXS_API
|
||||
void xerrlogHexPrintf(const void *buf, size_t buflen,
|
||||
const char *fmt, ...) EPICS_PRINTF_STYLE(3,4);
|
||||
void xerrlogHexPrintf(const void *buf, size_t buflen);
|
||||
|
||||
#define log_test(LOGGER, LVL) (LOGGER).test(::pvxs::Level::LVL)
|
||||
|
||||
@@ -56,13 +55,20 @@ void xerrlogHexPrintf(const void *buf, size_t buflen,
|
||||
|
||||
#define log_vprintf(LOGGER, LVL, FMT, ARGS) do{ if(log_test(LOGGER, LVL)) errlogVprintf(FMT, ARGS); }while(0)
|
||||
|
||||
#define log_hex_printf(LOGGER, LVL, BUF, BUFLEN, ...) do{ if(log_test(LOGGER, LVL)) xerrlogHexPrintf(BUF, BUFLEN, __VA_ARGS__); }while(0)
|
||||
#define log_hex_printf(LOGGER, LVL, BUF, BUFLEN, ...) do{ if(log_test(LOGGER, LVL)) { \
|
||||
xerrlogHexPrintf(BUF, BUFLEN); \
|
||||
errlogPrintf(__VA_ARGS__); } \
|
||||
}while(0)
|
||||
|
||||
//! Set level for a specific logger
|
||||
PVXS_API void logger_level_set(const char *name, int lvl);
|
||||
inline void logger_level_set(const char *name, Level lvl) {
|
||||
logger_level_set(name, int(lvl));
|
||||
}
|
||||
//! Remove any previously logger configurations.
|
||||
//! Does _not_ change any logger::lvl
|
||||
//! Use prior to re-applying new configuration.
|
||||
PVXS_API void logger_level_clear();
|
||||
|
||||
/** Configure logging from environment variable $PVXS_LOG
|
||||
*
|
||||
|
||||
@@ -290,8 +290,6 @@ void ServerConn::handle_GPR(pva_app_msg_t cmd)
|
||||
from_wire(M, ioid);
|
||||
from_wire(M, subcmd);
|
||||
|
||||
Status reply{};
|
||||
|
||||
// subcmd bitmask
|
||||
// 0x08 - Init
|
||||
// 0x10 - Destroy
|
||||
|
||||
Reference in New Issue
Block a user