summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2016-07-30 17:38:59 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-07-30 17:38:59 +0000
commit740c4788a0669989358f22fc822e1c1d206a4f9f (patch)
tree3a195ef8d2fdd86ff7211e96cc4496f8b1907c9b
parentacf5e849b4edd44fb87f2bab7833f5f242b91590 (diff)
parent9f05901b9ac580d93fb2cdf1bf8de9e64ba7570f (diff)
downloadsystem_core-740c4788a0669989358f22fc822e1c1d206a4f9f.tar.gz
system_core-740c4788a0669989358f22fc822e1c1d206a4f9f.tar.bz2
system_core-740c4788a0669989358f22fc822e1c1d206a4f9f.zip
Merge \"libbase should use its own logging!\"
am: 9f05901b9a Change-Id: I2260314d55a179004606a0a13d41249933486e9e
-rw-r--r--base/file.cpp11
-rw-r--r--base/logging.cpp3
2 files changed, 6 insertions, 8 deletions
diff --git a/base/file.cpp b/base/file.cpp
index da1adba19..4e7ac82d1 100644
--- a/base/file.cpp
+++ b/base/file.cpp
@@ -24,9 +24,8 @@
#include <string>
#include "android-base/macros.h" // For TEMP_FAILURE_RETRY on Darwin.
+#include "android-base/logging.h"
#include "android-base/utf8.h"
-#define LOG_TAG "base.file"
-#include "cutils/log.h"
#include "utils/Compat.h"
namespace android {
@@ -86,22 +85,22 @@ bool WriteStringToFile(const std::string& content, const std::string& path,
int flags = O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC | O_NOFOLLOW | O_BINARY;
int fd = TEMP_FAILURE_RETRY(open(path.c_str(), flags, mode));
if (fd == -1) {
- ALOGE("android::WriteStringToFile open failed: %s", strerror(errno));
+ PLOG(ERROR) << "android::WriteStringToFile open failed";
return false;
}
// We do an explicit fchmod here because we assume that the caller really
// meant what they said and doesn't want the umask-influenced mode.
if (fchmod(fd, mode) == -1) {
- ALOGE("android::WriteStringToFile fchmod failed: %s", strerror(errno));
+ PLOG(ERROR) << "android::WriteStringToFile fchmod failed";
return CleanUpAfterFailedWrite(path);
}
if (fchown(fd, owner, group) == -1) {
- ALOGE("android::WriteStringToFile fchown failed: %s", strerror(errno));
+ PLOG(ERROR) << "android::WriteStringToFile fchown failed";
return CleanUpAfterFailedWrite(path);
}
if (!WriteStringToFd(content, fd)) {
- ALOGE("android::WriteStringToFile write failed: %s", strerror(errno));
+ PLOG(ERROR) << "android::WriteStringToFile write failed";
return CleanUpAfterFailedWrite(path);
}
close(fd);
diff --git a/base/logging.cpp b/base/logging.cpp
index 769c266c9..959bb8b05 100644
--- a/base/logging.cpp
+++ b/base/logging.cpp
@@ -43,12 +43,11 @@
#include "android-base/macros.h"
#include "android-base/strings.h"
-#include "cutils/threads.h"
// Headers for LogMessage::LogLine.
#ifdef __ANDROID__
#include <android/set_abort_message.h>
-#include "cutils/log.h"
+#include "log/log.h"
#else
#include <sys/types.h>
#include <unistd.h>