cleaned up the output from the stm32 downloader code
diff --git a/aos/common/logging/logging_impl.cc b/aos/common/logging/logging_impl.cc
index a76c28a..980f65a 100644
--- a/aos/common/logging/logging_impl.cc
+++ b/aos/common/logging/logging_impl.cc
@@ -120,6 +120,16 @@
} // namespace internal
+StreamLogImplementation::StreamLogImplementation(FILE *stream)
+ : stream_(stream) {}
+
+void StreamLogImplementation::DoLog(log_level level, const char *format,
+ va_list ap) {
+ LogMessage message;
+ internal::FillInMessage(level, format, ap, &message);
+ internal::PrintMessage(stream_, message);
+}
+
void LogImplementation::DoVLog(log_level level, const char *format, va_list ap,
int levels) {
Context *context = Context::Get();
diff --git a/aos/common/logging/logging_impl.h b/aos/common/logging/logging_impl.h
index 1416fe1..18f35bc 100644
--- a/aos/common/logging/logging_impl.h
+++ b/aos/common/logging/logging_impl.h
@@ -114,6 +114,17 @@
LogImplementation *next_;
};
+// A log implementation that dumps all messages to a C stdio stream.
+class StreamLogImplementation : public LogImplementation {
+ public:
+ StreamLogImplementation(FILE *stream);
+
+ private:
+ virtual void DoLog(log_level level, const char *format, va_list ap);
+
+ FILE *const stream_;
+};
+
// Adds another implementation to the stack of implementations in this
// task/thread.
// Any tasks/threads created after this call will also use this implementation.