Merge "libbase: Have LogdLogger use LOGGER_ENTRY_MAX_PAYLOAD for its buffer"
This commit is contained in:
commit
2f6f86ff72
1 changed files with 5 additions and 5 deletions
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue