[Bug] Remove debug logs in release build.
[Cause] N/A
[Solution] N/A
[Verification] Build release/debug, run server.
Change-Id: Id34991a45e0fbee8edddfea10b64f69809141af3
namespace {
-std::ostream& operator<< (std::ostream& out, const char* const* argv)
+__attribute__((unused)) std::ostream& operator<< (std::ostream& out, const char* const* argv)
{
if (*argv) {
argv++; //skip
{
std::string parentPath = dirName(path);
bool newResult;
- bool ret = hasSameMountPoint(path, parentPath, newResult);
+ if (!hasSameMountPoint(path, parentPath, newResult)) {
+ LOGE("Failed to check the files' mount points");
+ return false;
+ }
result = !newResult;
- return ret;
+ return true;
}
bool hasSameMountPoint(const std::string& path1, const std::string& path2, bool& result)
&deleteCallbackWrapper<NameCallbacks>);
}
-void DbusConnection::onNameAcquired(GDBusConnection*, const gchar* name, gpointer userData)
+void DbusConnection::onNameAcquired(GDBusConnection*, __attribute__((unused)) const gchar* name, gpointer userData)
{
LOGD("Name acquired " << name);
const NameCallbacks& callbacks = getCallbackFromPointer<NameCallbacks>(userData);
}
}
-void DbusConnection::onNameLost(GDBusConnection*, const gchar* name, gpointer userData)
+void DbusConnection::onNameLost(GDBusConnection*, __attribute__((unused)) const gchar* name, gpointer userData)
{
LOGD("Name lost " << name);
const NameCallbacks& callbacks = getCallbackFromPointer<NameCallbacks>(userData);
{
if (!mCallbacks.empty()) {
LOGW("Not removed callbacks: " << mCallbacks.size());
- for (const auto& item : mCallbacks) {
+ for (__attribute__((unused)) const auto& item : mCallbacks) {
LOGT("Not removed fd: " << item.first);
}
assert(0 && "Not removed callbacks left");
}
bool Processor::onRemoteSignal(Peers::iterator& peerIt,
- const MethodID methodID,
- const MessageID messageID,
+ __attribute__((unused)) const MethodID methodID,
+ __attribute__((unused)) const MessageID messageID,
std::shared_ptr<SignalHandlers> signalCallbacks)
{
LOGS(mLogPrefix + "Processor onRemoteSignal; methodID: " << methodID << " messageID: " << messageID);
* @brief Automatically create LoggerScope object which logs at the construction and destruction
* @ingroup libLogger
*/
+#if !defined(NDEBUG)
#define LOGS(MSG) logger::LoggerScope logScopeObj(__FILE__, __LINE__, __func__, \
logger::SStreamWrapper() << MSG, \
PROJECT_SOURCE_DIR)
+#else
+#define LOGS(MSG) do {} while (0)
+#endif
#endif // COMMON_LOGGER_LOGGER_SCOPE_HPP
/// Logging information
#define LOGI(MESSAGE) LOG(INFO, MESSAGE)
+#if !defined(NDEBUG)
/// Logging debug information
#define LOGD(MESSAGE) LOG(DEBUG, MESSAGE)
/// Logging tracing information
#define LOGT(MESSAGE) LOG(TRACE, MESSAGE)
+#else
+#define LOGD(MESSAGE) do {} while (0)
+#define LOGH(MESSAGE) do {} while (0)
+#define LOGT(MESSAGE) do {} while (0)
+#endif
#endif // COMMON_LOGGER_LOGGER_HPP
-/*@}*/
\ No newline at end of file
+
+/*@}*/
* @brief Main file for the Vasum Daemon
*/
-// Always log to console in DEBUG mode
-#if !defined(LOG_TO_CONSOLE) && !defined(NDEBUG)
-#define LOG_TO_CONSOLE
-#endif
-
#include "config.hpp"
#include "exception.hpp"
}
Logger::setLogLevel(vm["log-level"].as<std::string>());
-#ifdef LOG_TO_CONSOLE
+#if !defined(NDEBUG)
Logger::setLogBackend(new StderrBackend());
#elif HAVE_SYSTEMD
Logger::setLogBackend(new SystemdJournalBackend());
BOOST_CHECK(tf.logContains("[TRACE]") == false);
}
+#if !defined(NDEBUG)
BOOST_AUTO_TEST_CASE(LogsLevelDebug)
{
TestLog tf(LogLevel::DEBUG);
BOOST_CHECK(tf.logContains("[DEBUG]") == true);
BOOST_CHECK(tf.logContains("[TRACE]") == true);
}
+#endif
BOOST_AUTO_TEST_CASE(LoggerScope)
{
return sendmsg(fd, &msg, MSG_NOSIGNAL);
}
// vasum_log
-API void vasum_log(int type, const char *tag, const char *fmt, ...) {
+API void vasum_log(__attribute__((unused)) int type,
+ __attribute__((unused)) const char *tag,
+ const char *fmt, ...) {
va_list arg_ptr;
char buf[255];
LOGS("type=" << type << " tag=" << tag);
* @brief Main file for the Vasum Daemon
*/
-// Always log to console in DEBUG mode
-#if !defined(LOG_TO_CONSOLE) && !defined(NDEBUG)
-#define LOG_TO_CONSOLE
-#endif
-
#include "config.hpp"
#include "exception.hpp"
}
Logger::setLogLevel(vm["log-level"].as<std::string>());
-#ifdef LOG_TO_CONSOLE
+#if !defined(NDEBUG)
Logger::setLogBackend(new StderrBackend());
#elif HAVE_SYSTEMD
Logger::setLogBackend(new SystemdJournalBackend());