Commit 8f86b215 authored by Stefan Hackenberg's avatar Stefan Hackenberg
Browse files

Add function name to log output

parent fda8f6a5
......@@ -22,15 +22,15 @@
// Genuine definitions
#if defined(LOG_LEVEL_TRACE)
#define TRACE(x, ...) std::printf("[TRACE: %s:%d] " x "\r\n", __FILE__, __LINE__, ##__VA_ARGS__);
#define TRACE(x, ...) std::printf("[TRACE: %s() %s:%d] " x "\r\n", __FUNCTION__, __FILE__, __LINE__, ##__VA_ARGS__);
#else
#define TRACE(x, ...)
#endif
#if defined(LOG_LEVEL_DEBUG)
#define DEBUG(x, ...) std::printf("[DEBUG: %s:%d] " x "\r\n", __FILE__, __LINE__, ##__VA_ARGS__);
#define DEBUG(x, ...) std::printf("[DEBUG: %s() %s:%d] " x "\r\n", __FUNCTION__, __FILE__, __LINE__, ##__VA_ARGS__);
#define DEBUGARRAY(buffer, length, x, ...) \
std::printf("[DEBUG: %s:%d] " x " ", __FILE__, __LINE__, ##__VA_ARGS__); \
std::printf("[DEBUG: %s() %s:%d] " x " ", __FUNCTION__, __FILE__, __LINE__, ##__VA_ARGS__); \
printfhex(buffer, length)
#else
#define DEBUG(x, ...)
......@@ -38,19 +38,19 @@
#endif
#if defined(LOG_LEVEL_INFO)
#define INFO(x, ...) std::printf("[INFO: %s:%d] " x "\r\n", __FILE__, __LINE__, ##__VA_ARGS__);
#define INFO(x, ...) std::printf("[INFO: %s() %s:%d] " x "\r\n", __FUNCTION__, __FILE__, __LINE__, ##__VA_ARGS__);
#else
#define INFO(x, ...)
#endif
#if defined(LOG_LEVEL_WARN)
#define WARN(x, ...) std::printf("[WARN: %s:%d] " x "\r\n", __FILE__, __LINE__, ##__VA_ARGS__);
#define WARN(x, ...) std::printf("[WARN: %s() %s:%d] " x "\r\n", __FUNCTION__, __FILE__, __LINE__, ##__VA_ARGS__);
#else
#define WARN(x, ...)
#endif
#if defined(LOG_LEVEL_ERROR)
#define ERROR(x, ...) std::printf("[ERROR: %s:%d] " x "\r\n", __FILE__, __LINE__, ##__VA_ARGS__);
#define ERROR(x, ...) std::printf("[ERROR: %s() %s:%d] " x "\r\n", __FUNCTION__, __FILE__, __LINE__, ##__VA_ARGS__);
#else
#define ERROR(x, ...)
#endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment