13#include "DebugServer2/Base.h"
14#include "DebugServer2/Utils/CompilerSupport.h"
34LogLevel GetLogLevel();
35void SetLogLevel(LogLevel level);
36void SetLogColorsEnabled(
bool enabled);
37std::string
const &GetLogOutputFilename();
38void SetLogOutputFilename(std::string
const &filename);
40void Log(
int level,
char const *classname,
char const *funcname,
41 char const *format, ...) DS2_ATTRIBUTE_PRINTF(4, 5);
45#if defined(BITSIZE_32)
46#define PRI_PTR "#010" PRIxPTR
47#elif defined(BITSIZE_64)
48#define PRI_PTR "#018" PRIxPTR
49#elif defined(BITSIZE_128)
50#define PRI_PTR "#034" PRIxPTR
53#define PRI_PTR_CAST(VAL) ((uintptr_t)(VAL))
55#if defined(COMPILER_MSVC)
56#define FUNCTION_NAME __FUNCTION__
57#elif defined(COMPILER_CLANG) || defined(COMPILER_GCC)
58#define FUNCTION_NAME __PRETTY_FUNCTION__
60#error "Compiler not supported."
63#define DS2LOG(LVL, ...) \
64 ds2::Log(ds2::kLogLevel##LVL, nullptr, FUNCTION_NAME, __VA_ARGS__)
67#define DS2ASSERT(COND) \
70 DS2LOG(Fatal, "assertion `%s' failed at %s:%d", #COND, __FILE__, \
76#define DS2ASSERT(COND) \
83#if defined(COMPILER_CLANG) || defined(COMPILER_GCC)
84#define DS2BUG(MESSAGE, ...) \
86 DS2LOG(Fatal, "bug at %s:%d: " MESSAGE, __FILE__, __LINE__, \
90#elif defined(COMPILER_MSVC)
91#define DS2BUG(MESSAGE, ...) \
93 DS2LOG(Fatal, "bug at %s:%d: " MESSAGE, __FILE__, __LINE__, __VA_ARGS__); \
97#error "Compiler not supported."