summaryrefslogtreecommitdiffstats
path: root/base/logging.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2018-05-23 09:16:46 -0700
committerElliott Hughes <enh@google.com>2018-05-23 10:06:20 -0700
commit1be0d1481b26281bf699238d5699b38a52b31382 (patch)
treeabe0ba22d28d621564481ef56040e27534605a11 /base/logging.cpp
parent9f6f8bf0dcb7f08c8c0afc1685f5d1a54b41b4cb (diff)
downloadsystem_core-1be0d1481b26281bf699238d5699b38a52b31382.tar.gz
system_core-1be0d1481b26281bf699238d5699b38a52b31382.tar.bz2
system_core-1be0d1481b26281bf699238d5699b38a52b31382.zip
Add StdioLogger for command-line tools.
Bug: N/A Test: ran tests Change-Id: If366a4ea25aea1becdd3e443eba225e9bd52ebba
Diffstat (limited to 'base/logging.cpp')
-rw-r--r--base/logging.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/base/logging.cpp b/base/logging.cpp
index a33da2211..978d56d07 100644
--- a/base/logging.cpp
+++ b/base/logging.cpp
@@ -212,6 +212,16 @@ void StderrLogger(LogId, LogSeverity severity, const char* tag, const char* file
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);