From 97f9e8935ba7ccaa8ae95db581f17c949e013172 Mon Sep 17 00:00:00 2001 From: Payam Date: Sat, 4 Apr 2020 09:15:43 -0400 Subject: [PATCH] removing file path from LOG_LEVEL and adding time stamp Change-Id: Ia32f21353adad4dcb4928909361fe0420c502c1e [ROCm/clr commit: 7052e21c877d8866eab772c8f04c67f738f5fda3] --- projects/clr/rocclr/utils/debug.cpp | 2 +- projects/clr/rocclr/utils/debug.hpp | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/projects/clr/rocclr/utils/debug.cpp b/projects/clr/rocclr/utils/debug.cpp index 235152085d..e0eb983ec1 100644 --- a/projects/clr/rocclr/utils/debug.cpp +++ b/projects/clr/rocclr/utils/debug.cpp @@ -88,7 +88,7 @@ void log_printf(LogLevel level, const char* file, int line, const char* format, vsnprintf(message, sizeof(message), format, ap); va_end(ap); - fprintf(stderr, ":%d:%s:%d: %s\n", level, file, line, message); + fprintf(stderr, ":%d:%-25s:%-4d: %010lld: %s\n", level, file, line, Os::timeNanos() / 100ULL, message); } } // namespace amd diff --git a/projects/clr/rocclr/utils/debug.hpp b/projects/clr/rocclr/utils/debug.hpp index eacb0bbc68..2cc0d3b85f 100644 --- a/projects/clr/rocclr/utils/debug.hpp +++ b/projects/clr/rocclr/utils/debug.hpp @@ -23,7 +23,7 @@ #include - +#include //! \addtogroup Utils namespace amd { /*@{*/ @@ -124,6 +124,8 @@ inline void warning(const char* msg) { amd::report_warning(msg); } #define Untested(msg) (void)(0) #endif /*NDEBUG*/ +#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__) + #define Log(level, msg) \ do { \ if (LOG_LEVEL >= level) { \ @@ -180,7 +182,7 @@ inline void warning(const char* msg) { amd::report_warning(msg); } if (LOG_LEVEL >= level) { \ if (GPU_LOG_MASK & mask || mask == amd::LOG_ALWAYS) { \ if (GPU_LOG_MASK & amd::LOG_LOCATION) { \ - amd::log_printf(level, __FILE__, __LINE__, format, ##__VA_ARGS__); \ + amd::log_printf(level, __FILENAME__, __LINE__, format, ##__VA_ARGS__); \ } else { \ amd::log_printf(level, "", 0, format, ##__VA_ARGS__); \ } \