Enable tizen dlogutil for chromium 17/284817/3
authoruzair <uzair.jaleel@samsung.com>
Mon, 28 Nov 2022 07:32:42 +0000 (13:02 +0530)
committerDae-Hyun Ko <dhyuna.ko@samsung.com>
Tue, 29 Nov 2022 01:59:57 +0000 (01:59 +0000)
Below change partially migrates [1] to enable dlogutil for tizen

[1]https://review.tizen.org/gerrit/c/174185

Change-Id: Ic96fa861ea304bcecacc46a84304ffb7f4f2cb89
Signed-off-by: uzair <uzair.jaleel@samsung.com>
base/logging.cc

index e02aa41..0c5d4a8 100644 (file)
@@ -900,6 +900,24 @@ LogMessage::~LogMessage() {
   }
 
   if (ShouldLogToStderr(severity_)) {
+#if defined(OS_TIZEN)
+    log_priority priority = DLOG_UNKNOWN;
+    switch (severity_) {
+      case LOG_INFO:
+        priority = DLOG_INFO;
+        break;
+      case LOG_WARNING:
+        priority = DLOG_WARN;
+        break;
+      case LOG_ERROR:
+        priority = DLOG_ERROR;
+        break;
+      case LOG_FATAL:
+        priority = DLOG_FATAL;
+        break;
+    }
+    dlog_print(priority, LOG_TAG, "%s", str_newline.c_str());
+#else
     // Not using fwrite() here, as there are crashes on Windows when CRT calls
     // malloc() internally, triggering an OOM crash. This likely means that the
     // process is close to OOM, but at least get the proper error message out,
@@ -912,6 +930,7 @@ LogMessage::~LogMessage() {
     //   free_something();
     // }
     WriteToFd(STDERR_FILENO, str_newline.data(), str_newline.size());
+#endif
   }
 
   if ((g_logging_destination & LOG_TO_FILE) != 0) {