Add StdioLogger for command-line tools.
Bug: N/A
Test: ran tests
Change-Id: If366a4ea25aea1becdd3e443eba225e9bd52ebba
diff --git a/base/logging.cpp b/base/logging.cpp
index a33da22..978d56d 100644
--- a/base/logging.cpp
+++ b/base/logging.cpp
@@ -212,6 +212,16 @@
timestamp, getpid(), GetThreadId(), file, line, message);
}
+void StdioLogger(LogId, LogSeverity severity, const char* /*tag*/, const char* /*file*/,
+ unsigned int /*line*/, const char* message) {
+ if (severity >= WARNING) {
+ fflush(stdout);
+ fprintf(stderr, "%s: %s\n", getprogname(), message);
+ } else {
+ fprintf(stdout, "%s\n", message);
+ }
+}
+
void DefaultAborter(const char* abort_message) {
#ifdef __ANDROID__
android_set_abort_message(abort_message);