AOS_LOG to messages

Change-Id: I0cb78a957a180f4472fc3e78a75eade63e4e43b8
diff --git a/aos/logging/implementations.h b/aos/logging/implementations.h
index 78980ff..6cf8376 100644
--- a/aos/logging/implementations.h
+++ b/aos/logging/implementations.h
@@ -132,6 +132,7 @@
 // when needed or by calling Load()).
 // The logging system takes ownership of implementation. It will delete it if
 // necessary, so it must be created with new.
+// TODO: Log implementations are never deleted. Need means to safely deregister.
 void SetImplementation(LogImplementation *implementation,
                        bool update_global = true);
 
@@ -139,6 +140,8 @@
 // implementation.
 LogImplementation *SwapImplementation(LogImplementation *implementation);
 
+LogImplementation *GetImplementation();
+
 // Must be called at least once per process/load before anything else is
 // called. This function is safe to call multiple times from multiple
 // tasks/threads.
@@ -164,7 +167,18 @@
 void RegisterQueueImplementation();
 
 void RegisterCallbackImplementation(
-    const ::std::function<void(const LogMessage &)> &callback);
+    const ::std::function<void(const LogMessage &)> &callback,
+    bool update_global = true);
+
+class ScopedLogRestorer {
+ public:
+  ScopedLogRestorer() { prev_impl_ = GetImplementation(); }
+
+  ~ScopedLogRestorer() { SetImplementation(prev_impl_); }
+
+ private:
+  LogImplementation *prev_impl_;
+};
 
 // This is where all of the code that is only used by actual LogImplementations
 // goes.