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

Commit 2f6f86ff authored by Tom Cherry's avatar Tom Cherry Committed by Gerrit Code Review
Browse files

Merge "libbase: Have LogdLogger use LOGGER_ENTRY_MAX_PAYLOAD for its buffer"

parents 938379de 42ee2e4f
Loading
Loading
Loading
Loading
+5 −5
Original line number Original line Diff line number Diff line
@@ -340,18 +340,18 @@ void LogdLogger::operator()(LogId id, LogSeverity severity, const char* tag,


  int lg_id = LogIdTolog_id_t(id);
  int lg_id = LogIdTolog_id_t(id);


  char log_message[1024];
  char log_message_with_file[4068];  // LOGGER_ENTRY_MAX_PAYLOAD, not available in the NDK.
  if (priority == ANDROID_LOG_FATAL && file != nullptr) {
  if (priority == ANDROID_LOG_FATAL && file != nullptr) {
    snprintf(log_message, sizeof(log_message), "%s:%u] %s", file, line, message);
    snprintf(log_message_with_file, sizeof(log_message_with_file), "%s:%u] %s", file, line,
  } else {
             message);
    snprintf(log_message, sizeof(log_message), "%s", message);
    message = log_message_with_file;
  }
  }


  static auto& liblog_functions = GetLibLogFunctions();
  static auto& liblog_functions = GetLibLogFunctions();
  if (liblog_functions) {
  if (liblog_functions) {
    __android_logger_data logger_data = {sizeof(__android_logger_data),     lg_id, priority, tag,
    __android_logger_data logger_data = {sizeof(__android_logger_data),     lg_id, priority, tag,
                                         static_cast<const char*>(nullptr), 0};
                                         static_cast<const char*>(nullptr), 0};
    liblog_functions->__android_log_logd_logger(&logger_data, log_message);
    liblog_functions->__android_log_logd_logger(&logger_data, message);
  } else {
  } else {
    __android_log_buf_print(lg_id, priority, tag, "%s", message);
    __android_log_buf_print(lg_id, priority, tag, "%s", message);
  }
  }