Enchance logging 28/76628/1 accepted/tizen/common/20160703.125642 accepted/tizen/ivi/20160629.015642 accepted/tizen/mobile/20160629.015604 accepted/tizen/tv/20160629.015715 accepted/tizen/wearable/20160629.015515 submit/tizen/20160627.042541 submit/tizen_common/20160701.180000
authorTomasz Iwanek <t.iwanek@samsung.com>
Fri, 24 Jun 2016 12:13:21 +0000 (14:13 +0200)
committerTomasz Iwanek <t.iwanek@samsung.com>
Fri, 24 Jun 2016 12:40:22 +0000 (14:40 +0200)
Although we should use debugger for troubleshooting, this may be
usefull for short analysis.

Change-Id: I06136949d6799269bbc4760f79d2eaddc69f5cd4

src/manifest_parser/utils/logging.h

index a2af21c048f48d6486f808b59dc397f8627b4ced..2ed3ba06a83914eb5a3adae35d49af934eb7e56f 100644 (file)
 #endif
 
 #include <cassert>
+#include <cstring>
 #include <iomanip>
 #include <iostream>
 #include <sstream>
 #include <string>
 
+#ifndef __FILENAME__
+#define __FILENAME__                                                           \
+    (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
+#endif
+
 namespace utils {
 
 enum class LogLevel {
@@ -104,7 +110,9 @@ inline static const constexpr char* __tag_for_project() {
       ::utils::LogLevel::LOG_ ## LEVEL, __tag_for_project())                   \
       & ::utils::StringStream<char>()                                          \
       << std::string(::utils::LogTag<::utils::LogLevel::LOG_ ## LEVEL>::value) \
-      << " " << std::setw(20) << std::left << __tag_for_logging()              \
+      << " " << std::setw(25) << std::left << __tag_for_logging()              \
+      << " : " << std::setw(36)                                                \
+      << (std::string(__FILENAME__) + ":" + std::to_string(__LINE__)).c_str()  \
       << std::setw(0) << " : "                                                 \
 
 #endif  // MANIFEST_PARSER_UTILS_LOGGING_H_