Build API: Use the goma log options when available

Sets the goma log dir, and the stats and counterz file names when
passed through in an API call.

BUG=chromium:1031259
TEST=./run_tests

Change-Id: I571b93aa3a926d9816b694b38522ab0b7bbeee54
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/1958960
Commit-Queue: Alex Klein <saklein@chromium.org>
Tested-by: Alex Klein <saklein@chromium.org>
Reviewed-by: Michael Mortensen <mmortensen@google.com>
diff --git a/api/controller/controller_util.py b/api/controller/controller_util.py
index aa18bb7..9c6abaf 100644
--- a/api/controller/controller_util.py
+++ b/api/controller/controller_util.py
@@ -65,12 +65,20 @@
     elif chroot_message.goma.goma_approach == common_pb2.GomaConfig.RBE_STAGING:
       goma_approach = goma_util.GomaApproach('?staging',
                                              'staging-goma.chromium.org', True)
+
+    log_dir = chroot_message.goma.log_dir.dir or None
+    stats_filename = chroot_message.goma.stats_file or None
+    counterz_filename = chroot_message.goma.counterz_file or None
+
     goma = goma_util.Goma(chroot_message.goma.goma_dir,
                           chroot_message.goma.goma_client_json,
                           stage_name='BuildAPI',
                           chromeos_goma_dir=chromeos_goma_dir,
                           chroot_dir=path,
-                          goma_approach=goma_approach)
+                          goma_approach=goma_approach,
+                          log_dir=log_dir,
+                          stats_filename=stats_filename,
+                          counterz_filename=counterz_filename)
 
   return Chroot(path=path, cache_dir=cache_dir, chrome_root=chrome_root,
                 env=env, goma=goma)