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
This commit is contained in:
Mark Salyzyn 2019-02-12 15:26:34 -08:00
parent 6b3f587ac7
commit 75941f2c9c
1 changed files with 5 additions and 2 deletions

View File

@ -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