Add standard gc log for transition collections.

Factor out the gc log logic into a function.

Note we still don't log in background as before but do for things like
OOME compactions in foreground.

Change-Id: Ifd35a796cf26aba2fba83bf07e72902357d91f8b
diff --git a/runtime/gc/heap.h b/runtime/gc/heap.h
index 57c1460..b2478e6 100644
--- a/runtime/gc/heap.h
+++ b/runtime/gc/heap.h
@@ -666,12 +666,13 @@
   class CollectorTransitionTask;
   class HeapTrimTask;
 
-  // Compact source space to target space.
-  void Compact(space::ContinuousMemMapAllocSpace* target_space,
-               space::ContinuousMemMapAllocSpace* source_space,
-               GcCause gc_cause)
+  // Compact source space to target space. Returns the collector used.
+  collector::GarbageCollector* Compact(space::ContinuousMemMapAllocSpace* target_space,
+                                       space::ContinuousMemMapAllocSpace* source_space,
+                                       GcCause gc_cause)
       EXCLUSIVE_LOCKS_REQUIRED(Locks::mutator_lock_);
 
+  void LogGC(GcCause gc_cause, collector::GarbageCollector* collector);
   void FinishGC(Thread* self, collector::GcType gc_type) LOCKS_EXCLUDED(gc_complete_lock_);
 
   // Create a mem map with a preferred base address.