From 75941f2c9c68c0e815cd48afe37eec271eb88d80 Mon Sep 17 00:00:00 2001 From: Mark Salyzyn Date: Tue, 12 Feb 2019 15:26:34 -0800 Subject: [PATCH] fs_mgr: remount: log to stderr and logd Logging normally goes to stderr, also send output redirected to the Android Logger. Required if command is exec'd, useful if commanded from shell. Test: manual confirmation of both outputs. Bug: 122602260 Change-Id: Ibc2e14bd4fad561514c0c33741da8ca6f00af3f3 --- fs_mgr/fs_mgr_remount.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fs_mgr/fs_mgr_remount.cpp b/fs_mgr/fs_mgr_remount.cpp index 66756ab6f..1cec54327 100644 --- a/fs_mgr/fs_mgr_remount.cpp +++ b/fs_mgr/fs_mgr_remount.cpp @@ -96,14 +96,17 @@ void try_unmount_bionic(android::fs_mgr::Fstab* mounts) { } } -void MyLogger(android::base::LogId, android::base::LogSeverity severity, const char*, const char*, - unsigned int, const char* message) { +void MyLogger(android::base::LogId id, android::base::LogSeverity severity, const char* tag, + const char* file, unsigned int line, const char* message) { static const char log_characters[] = "VD\0WEFF"; if (severity < sizeof(log_characters)) { auto severity_char = log_characters[severity]; if (severity_char) fprintf(stderr, "%c ", severity_char); } fprintf(stderr, "%s\n", message); + + static auto logd = android::base::LogdLogger(); + logd(id, severity, tag, file, line, message); } } // namespace