Log line-at-a-time to work around Android logging lossage.
Also deduplicate the two copies of gettid, and switch image_test over
to using SignalCatcher's SIGQUIT dumping rather than rolling its own
subset.
Change-Id: I8b70aaa3a3b9258c8258728c6a66e5dc4fa6399e
diff --git a/src/logging_android.cc b/src/logging_android.cc
index 8acb6ef..0d64c60 100644
--- a/src/logging_android.cc
+++ b/src/logging_android.cc
@@ -1,4 +1,18 @@
-// Copyright 2011 Google Inc. All Rights Reserved.
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#include "logging.h"
@@ -6,28 +20,17 @@
#include <unistd.h>
#include "cutils/log.h"
-#include "runtime.h"
static const int kLogSeverityToAndroidLogPriority[] = {
ANDROID_LOG_INFO, ANDROID_LOG_WARN, ANDROID_LOG_ERROR, ANDROID_LOG_FATAL
};
LogMessage::LogMessage(const char* file, int line, LogSeverity severity, int error)
-: file_(file), line_(line), severity_(severity), errno_(error)
+: file_(file), line_number_(line), severity_(severity), errno_(error)
{
}
-LogMessage::~LogMessage() {
- if (errno_ != -1) {
- stream() << ": " << strerror(errno_);
- }
+void LogMessage::LogLine(const char* line) {
int priority = kLogSeverityToAndroidLogPriority[severity_];
- LOG_PRI(priority, LOG_TAG, "%s", buffer_.str().c_str());
- if (severity_ == FATAL) {
- art::Runtime::Abort(file_, line_);
- }
-}
-
-std::ostream& LogMessage::stream() {
- return buffer_;
+ LOG_PRI(priority, LOG_TAG, "%s", line);
}