lib/apilog: use ctx based logging and sundry bug fixes.

- context.T now wraps rather than embeds logging.Logger
  to avoid an annoying go'ism, namely if a struct
  with an embedded struct/interface is converted to
  an interface then a 'autogenerated' call frame is
  inserted in order to create the interface instance. This
  messes up the 'InfoDepth' usage.
- logger.Manager needs to test for context.T and extract its
  underlying implementation in order to work correctly.
  This was the root cause of the bug fixed by: v.io/c/12543
- expand the unit tests to hopefully catch any regressions.

MultiPart: 1/2

Change-Id: I76b1723d31d394be481b4c2947838a1a5096df73
diff --git a/runtime/internal/rt/runtime.go b/runtime/internal/rt/runtime.go
index 6940890..09d1b70 100644
--- a/runtime/internal/rt/runtime.go
+++ b/runtime/internal/rt/runtime.go
@@ -13,6 +13,7 @@
 	"syscall"
 	"time"
 
+	"v.io/x/lib/metadata"
 	"v.io/x/lib/pubsub"
 	"v.io/x/lib/vlog"
 
@@ -112,14 +113,9 @@
 	// log_dir for the program.  It's a hack, but it gets us the metadata
 	// to device manager-run apps and avoids it for command-lines, which is
 	// a good enough approximation.
-
-	// TODO(caprita): Disabled on 6/11/2015 because changes in the logging
-	// system caused this to be always printed.  Re-enable in a different
-	// way.
-
-	// if logger.Manager(ctx).LogDir() != os.TempDir() {
-	// 	ctx.Infof(metadata.ToXML())
-	// }
+	if logger.Manager(ctx).LogDir() != os.TempDir() {
+		ctx.Infof(metadata.ToXML())
+	}
 
 	// Setup the initial trace.
 	ctx, err = ivtrace.Init(ctx, flags.Vtrace)