Patch copied from: https://android.googlesource.com/platform/system/core/+/e5dd71a290f664d3f3bf0dd8a4bad411dc7ad416 From e5dd71a290f664d3f3bf0dd8a4bad411dc7ad416 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Thu, 28 Jul 2016 15:15:28 -0700 Subject: [PATCH] libbase should use its own logging! Not doing so led to us using a bogus log tag. Bug: http://b/30281203 Change-Id: I3ac91758a1a043146c65f2ae0f36fcfbe372c30f --- base/file.cpp | 11 +++++------ base/logging.cpp | 3 +-- 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 #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 -#include "cutils/log.h" +#include "log/log.h" #else #include #include -- 2.11.0 /guix/commit/HACKING?id=6701edbfad62ba9572ffd35497df3db27b208ba5'>HACKING: Update key server....Ludovic Courtès 2018-07-22doc: Fix typo (missing period)...Pierre Neidhardt 2017-08-19doc: Mention how to use emacs-debbugs....Arun Isaac 2017-03-27maint: Give command to install the pre-push hook....Ludovic Courtès 2017-03-24maint: Mention the Signed-off-by line in 'HACKING'....Clément Lassieur 2017-03-15maint: Mention guix-patches@gnu.org in 'HACKING'....Ludovic Courtès 2017-01-30maint: Fix invalid calls to 'info'....Mathieu Lirzin 2017-01-04doc: Add a Git hook that verifies signatures before pushing....Leo Famulari 2016-07-24doc: Explain how to set up Git for signing....Ludovic Courtès 2016-07-14doc: Mention commit signatures in HACKING....Leo Famulari 2015-06-14doc: Move most 'HACKING' informations into the manual....Mathieu Lirzin 2015-06-10doc: Add 'help2man' to HACKING....Alex Kost 2015-05-23doc: Add "Running Guix Before It Is Installed"....Ludovic Courtès 2015-02-26doc: Remove reference to git submodules in HACKING....Mark H Weaver