#ifndef SRC_COMMON_LOG_BACKTRACE_H_
#define SRC_COMMON_LOG_BACKTRACE_H_
+#ifndef CYNARA_NO_LOGS
#define UNW_LOCAL_ONLY
#include <libunwind.h>
+#endif
#include <string>
namespace Cynara {
class Backtrace {
public:
-#ifdef BUILD_TYPE_DEBUG
+#if defined(BUILD_TYPE_DEBUG) && !defined(CYNARA_NO_LOGS)
static const std::string getBacktrace(void);
#else
static const std::string getBacktrace(void) {
void operator=(Backtrace const &) = delete;
const std::string buildBacktrace(void);
+#ifndef CYNARA_NO_LOGS
void getSourceInfo(unw_word_t proc_address);
+#endif
private:
const char *m_fileName;
#ifndef CYNARA_COMMON_LOG_H
#define CYNARA_COMMON_LOG_H
+#ifndef CYNARA_NO_LOGS
#include <systemd/sd-journal.h>
+#endif
extern int __log_level;
-#define __LOG(LEVEL, ...) \
- do { \
- if(LEVEL <= __log_level) \
- sd_journal_print(LEVEL, __VA_ARGS__); \
- } while (0)
+#ifndef CYNARA_NO_LOGS
+ #define __LOG(LEVEL, ...) \
+ do { \
+ if(LEVEL <= __log_level) \
+ sd_journal_print(LEVEL, __VA_ARGS__); \
+ } while (0)
+#else
+ #define __LOG(LEVEL, ...)
+#endif
#define LEGM(...) __LOG(LOG_EMERG, __VA_ARGS__) /* system is unusable */
#define LOGA(...) __LOG(LOG_ALERT, __VA_ARGS__) /* action must be taken immediately */
ADD_DEFINITIONS("-Werror") # Make all warnings into errors.
ADD_DEFINITIONS("-Wall") # Generate all warnings
ADD_DEFINITIONS("-Wextra") # Generate even more extra warnings
+ADD_DEFINITIONS("-DCYNARA_NO_LOGS") # Disable building logs
MESSAGE(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")