Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c8526723 authored by Henri Chataing's avatar Henri Chataing
Browse files

bluetooth/log: Implement expected behavior on fatal logs

The following is not implemented in __android_log_write_log_message
and needs to be added to vlog_android
- Write message line to stderr for gtest and debugging
- Invoke abort() after writing the log line

Bug: 305066880
Test: atest bluetooth_test_sdp
Flag: EXEMPT, tool change
Change-Id: I21c359d75a2b922211464f0920038ae507af0148
parent 958dd017
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -48,6 +48,15 @@ void vlog(Level level, char const* tag, char const* file_name, int line,
      .message = buffer.c_str(),
  };
  __android_log_write_log_message(&message);

  if (level == Level::kFatal) {
    // Log assertion failures to stderr for the benefit of "adb shell" users
    // and gtests (http://b/23675822).
    char const* buf = buffer.c_str();
    TEMP_FAILURE_RETRY(write(2, buf, strlen(buf)));
    TEMP_FAILURE_RETRY(write(2, "\n", 1));
    __android_log_call_aborter(buf);
  }
}

}  // namespace bluetooth::log_internal