SetAborter and SetLogger return old function.

This is very useful when implementing a log capture RAII class.
The class can reset the logger to whatever it was before on
destruction instead of assuming it was the default.

Test: atest --host libbase_test
Change-Id: I62127c84a1d275c7fb24b0d1aafd5fcbe4a19ec6
diff --git a/logging.cpp b/logging.cpp
index a0dd5f9..d6ecc78 100644
--- a/logging.cpp
+++ b/logging.cpp
@@ -397,7 +397,8 @@
   }
 }
 
-void SetLogger(LogFunction&& logger) {
+LogFunction SetLogger(LogFunction&& logger) {
+  LogFunction old_logger = std::move(Logger());
   Logger() = std::move(logger);
 
   static auto& liblog_functions = GetLibLogFunctions();
@@ -410,9 +411,11 @@
                log_message->message);
     });
   }
+  return old_logger;
 }
 
-void SetAborter(AbortFunction&& aborter) {
+AbortFunction SetAborter(AbortFunction&& aborter) {
+  AbortFunction old_aborter = std::move(Aborter());
   Aborter() = std::move(aborter);
 
   static auto& liblog_functions = GetLibLogFunctions();
@@ -420,6 +423,7 @@
     liblog_functions->__android_log_set_aborter(
         [](const char* abort_message) { Aborter()(abort_message); });
   }
+  return old_aborter;
 }
 
 // This indirection greatly reduces the stack impact of having lots of