[dart][flutter] Runners do not depend on libfxl anymore.

Bug: DX-1073
Change-Id: I35699760454596c93ae65cfef0004c39b737125f
diff --git a/runtime/dart/utils/BUILD.gn b/runtime/dart/utils/BUILD.gn
index e34fca7..3f91870 100644
--- a/runtime/dart/utils/BUILD.gn
+++ b/runtime/dart/utils/BUILD.gn
@@ -60,6 +60,28 @@
   ]
 }
 
+source_set("inlines") {
+  sources = [
+    "inlines.h",
+  ]
+
+  public_deps = [
+    "//zircon/public/lib/syslog",
+  ]
+}
+
+source_set("files") {
+  sources = [
+    "files.cc",
+    "files.h",
+  ]
+
+  deps = [
+    ":inlines",
+    ":logging",
+  ]
+}
+
 package("run_vmservice_object_tests") {
   testonly = true
 
diff --git a/runtime/dart/utils/files.cc b/runtime/dart/utils/files.cc
new file mode 100644
index 0000000..772fb71
--- /dev/null
+++ b/runtime/dart/utils/files.cc
@@ -0,0 +1,78 @@
+// Copyright 2019 The Fuchsia Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "topaz/runtime/dart/utils/files.h"
+
+#include <fcntl.h>
+#include <stdint.h>
+
+#include "topaz/runtime/dart/utils/inlines.h"
+#include "topaz/runtime/dart/utils/logging.h"
+
+namespace dart_utils {
+
+namespace {
+
+bool ReadFileDescriptor(int fd, std::string* result) {
+  DEBUG_CHECK(result, LOG_TAG, "");
+  result->clear();
+
+  if (fd < 0) {
+    return false;
+  }
+
+  constexpr size_t kBufferSize = 1 << 16;
+  size_t offset = 0;
+  ssize_t bytes_read = 0;
+  do {
+    offset += bytes_read;
+    result->resize(offset + kBufferSize);
+    bytes_read = read(fd, &(*result)[offset], kBufferSize);
+  } while (bytes_read > 0);
+
+  if (bytes_read < 0) {
+    result->clear();
+    return false;
+  }
+
+  result->resize(offset + bytes_read);
+  return true;
+}
+
+bool WriteFileDescriptor(int fd, const char* data, ssize_t size) {
+  ssize_t total = 0;
+  for (ssize_t partial = 0; total < size; total += partial) {
+    partial = write(fd, data + total, size - total);
+    if (partial < 0)
+      return false;
+  }
+  return true;
+}
+
+}  // namespace
+
+bool ReadFileToString(const std::string& path, std::string* result) {
+  return ReadFileToStringAt(AT_FDCWD, path, result);
+}
+
+bool ReadFileToStringAt(int dirfd, const std::string& path,
+                        std::string* result) {
+  int fd = openat(dirfd, path.c_str(), O_RDONLY);
+  bool status = ReadFileDescriptor(fd, result);
+  close(fd);
+  return status;
+}
+
+bool WriteFile(const std::string& path, const char* data, ssize_t size) {
+  int fd = openat(
+      AT_FDCWD, path.c_str(), O_CREAT | O_TRUNC | O_WRONLY, 0666);
+  if (fd < 0) {
+    return false;
+  }
+  bool status = WriteFileDescriptor(fd, data, size);
+  close(fd);
+  return status;
+}
+
+}  // namespace dart_utils
diff --git a/runtime/dart/utils/files.h b/runtime/dart/utils/files.h
new file mode 100644
index 0000000..33744bb
--- /dev/null
+++ b/runtime/dart/utils/files.h
@@ -0,0 +1,26 @@
+// Copyright 2019 The Fuchsia Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef TOPAZ_RUNTIME_DART_UTILS_FILES_H_
+#define TOPAZ_RUNTIME_DART_UTILS_FILES_H_
+
+#include <string>
+
+namespace dart_utils {
+
+// Reads the contents of the file at the given path or file descriptor and
+// stores the data in result. Returns true if the file was read successfully,
+// otherwise returns false. If this function returns false, |result| will be
+// the empty string.
+bool ReadFileToString(const std::string& path, std::string* result);
+bool ReadFileToStringAt(int dirfd, const std::string& path,
+                        std::string* result);
+
+// Writes the given data to the file at the given path. Returns true if the data
+// was successfully written, otherwise returns false.
+bool WriteFile(const std::string& path, const char* data, ssize_t size);
+
+}  // namespace dart_utils
+
+#endif  // TOPAZ_RUNTIME_DART_UTILS_FILES_H_
diff --git a/runtime/dart/utils/inlines.h b/runtime/dart/utils/inlines.h
new file mode 100644
index 0000000..ef9f0f2
--- /dev/null
+++ b/runtime/dart/utils/inlines.h
@@ -0,0 +1,32 @@
+// Copyright 2019 The Fuchsia Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef TOPAZ_RUNTIME_DART_UTILS_INLINES_H_
+#define TOPAZ_RUNTIME_DART_UTILS_INLINES_H_
+
+#include <lib/syslog/global.h>
+
+namespace dart_utils {
+
+inline void Check(bool condition, const char* tag, const char* message = "") {
+  if (!condition) {
+    FX_LOG(FATAL, tag, message);
+  }
+}
+
+#ifndef NDEBUG
+#define DEBUG_CHECK(condition, tag, message) \
+dart_utils::Check(condition, tag, message)
+#else
+#define DEBUG_CHECK(condition, tag, message) (true || (condition))
+#endif
+
+template<size_t SIZE, typename T>
+inline size_t ArraySize(T (&array)[SIZE]) {
+  return SIZE;
+}
+
+}  // namespace dart_utils
+
+#endif  // TOPAZ_RUNTIME_DART_UTILS_INLINES_H_
diff --git a/runtime/dart_runner/BUILD.gn b/runtime/dart_runner/BUILD.gn
index 4dd6b46..fdf8986 100644
--- a/runtime/dart_runner/BUILD.gn
+++ b/runtime/dart_runner/BUILD.gn
@@ -25,6 +25,7 @@
       "dart_component_controller.h",
       "dart_runner.cc",
       "dart_runner.h",
+      "logging.h",
       "main.cc",
       "mapped_resource.cc",
       "mapped_resource.h",
@@ -43,14 +44,15 @@
     ]
 
     deps = [
-             "//garnet/public/lib/fxl",
              "//topaz/runtime/dart/utils",
+             "//topaz/runtime/dart/utils:inlines",
              "//topaz/runtime/dart/utils:vmo",
              "//third_party/tonic",
              "//topaz/public/dart-pkg/fuchsia",
              "//zircon/public/lib/async",
              "//zircon/public/lib/async-loop",
              "//zircon/public/lib/async-loop-cpp",
+             "//zircon/public/lib/syslog",
              "//zircon/public/lib/trace",
              "//zircon/public/lib/trace-provider",
            ] + dart_deps + extra_deps
diff --git a/runtime/dart_runner/builtin_libraries.cc b/runtime/dart_runner/builtin_libraries.cc
index 7003bd5..ac79fe1 100644
--- a/runtime/dart_runner/builtin_libraries.cc
+++ b/runtime/dart_runner/builtin_libraries.cc
@@ -8,13 +8,14 @@
 #include <lib/zx/channel.h>
 
 #include "dart-pkg/fuchsia/sdk_ext/fuchsia.h"
-#include "lib/fxl/arraysize.h"
-#include "lib/fxl/logging.h"
 #include "third_party/dart/runtime/bin/io_natives.h"
 #include "third_party/dart/runtime/include/dart_api.h"
 #include "third_party/tonic/converter/dart_converter.h"
 #include "third_party/tonic/dart_microtask_queue.h"
 #include "third_party/tonic/logging/dart_error.h"
+#include "topaz/runtime/dart/utils/inlines.h"
+
+#include "topaz/runtime/dart_runner/logging.h"
 
 using tonic::ToDart;
 
@@ -41,10 +42,10 @@
                                         bool* auto_setup_scope) {
   const char* function_name = nullptr;
   DART_CHECK_VALID(Dart_StringToCString(name, &function_name));
-  FXL_DCHECK(function_name != nullptr);
-  FXL_DCHECK(auto_setup_scope != nullptr);
+  DEBUG_CHECK(function_name != nullptr, LOG_TAG, "");
+  DEBUG_CHECK(auto_setup_scope != nullptr, LOG_TAG, "");
   *auto_setup_scope = true;
-  size_t num_entries = arraysize(kBuiltinEntries);
+  size_t num_entries = dart_utils::ArraySize(kBuiltinEntries);
   for (size_t i = 0; i < num_entries; i++) {
     const NativeEntry& entry = kBuiltinEntries[i];
     if (!strcmp(function_name, entry.name) &&
@@ -56,7 +57,7 @@
 }
 
 const uint8_t* BuiltinNativeSymbol(Dart_NativeFunction native_function) {
-  size_t num_entries = arraysize(kBuiltinEntries);
+  size_t num_entries = dart_utils::ArraySize(kBuiltinEntries);
   for (size_t i = 0; i < num_entries; i++) {
     const NativeEntry& entry = kBuiltinEntries[i];
     if (entry.function == native_function)
diff --git a/runtime/dart_runner/dart_component_controller.cc b/runtime/dart_runner/dart_component_controller.cc
index a269d40..8cd8618 100644
--- a/runtime/dart_runner/dart_component_controller.cc
+++ b/runtime/dart_runner/dart_component_controller.cc
@@ -11,6 +11,7 @@
 #include <lib/fdio/directory.h>
 #include <lib/fdio/fd.h>
 #include <lib/fdio/namespace.h>
+#include <lib/syslog/global.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <zircon/status.h>
@@ -22,8 +23,6 @@
 
 #include "lib/fidl/cpp/optional.h"
 #include "lib/fidl/cpp/string.h"
-#include "lib/fxl/arraysize.h"
-#include "lib/fxl/logging.h"
 #include "third_party/dart/runtime/include/dart_tools_api.h"
 #include "third_party/tonic/converter/dart_converter.h"
 #include "third_party/tonic/dart_message_handler.h"
@@ -31,9 +30,11 @@
 #include "third_party/tonic/dart_state.h"
 #include "third_party/tonic/logging/dart_error.h"
 #include "topaz/runtime/dart/utils/handle_exception.h"
+#include "topaz/runtime/dart/utils/inlines.h"
 #include "topaz/runtime/dart/utils/tempfs.h"
 
-#include "builtin_libraries.h"
+#include "topaz/runtime/dart_runner/builtin_libraries.h"
+#include "topaz/runtime/dart_runner/logging.h"
 
 using tonic::ToDart;
 
@@ -90,7 +91,8 @@
     }
   }
   if (data_path_.empty()) {
-    FXL_LOG(ERROR) << "Could not find a /pkg/data directory for " << url_;
+    FX_LOGF(ERROR, LOG_TAG, "Could not find a /pkg/data directory for %s",
+            url_.c_str());
     return;
   }
   if (controller.is_valid()) {
@@ -101,8 +103,8 @@
   zx_status_t status =
       zx::timer::create(ZX_TIMER_SLACK_LATE, ZX_CLOCK_MONOTONIC, &idle_timer_);
   if (status != ZX_OK) {
-    FXL_LOG(INFO) << "Idle timer creation failed: "
-                  << zx_status_get_string(status);
+    FX_LOGF(INFO, LOG_TAG, "Idle timer creation failed: %s",
+            zx_status_get_string(status));
   } else {
     idle_wait_.set_object(idle_timer_.get());
     idle_wait_.set_trigger(ZX_TIMER_SIGNALED);
@@ -129,13 +131,12 @@
   }
 
   if (SetupFromAppSnapshot()) {
-    FXL_LOG(INFO) << url_ << " is running from an app snapshot";
+    FX_LOGF(INFO, LOG_TAG, "%s is running from an app snapshot", url_.c_str());
   } else if (SetupFromKernel()) {
-    FXL_LOG(INFO) << url_ << " is running from kernel";
+    FX_LOGF(INFO, LOG_TAG, "%s is running from kernel", url_.c_str());
   } else {
-    FXL_LOG(ERROR)
-        << "Could not find a program in " << url_
-        << ". Was data specified correctly in the component manifest?";
+    FX_LOGF(ERROR, LOG_TAG, "Could not find a program in %s. Was data specified"
+            " correctly in the component manifest?", url_.c_str());
     return false;
   }
 
@@ -149,7 +150,7 @@
   fuchsia::sys::FlatNamespace* flat = &startup_info_.flat_namespace;
   zx_status_t status = fdio_ns_create(&namespace_);
   if (status != ZX_OK) {
-    FXL_LOG(ERROR) << "Failed to create namespace";
+    FX_LOG(ERROR, LOG_TAG, "Failed to create namespace");
     return false;
   }
 
@@ -173,8 +174,8 @@
     const char* path = flat->paths.at(i).data();
     status = fdio_ns_bind(namespace_, path, dir_handle);
     if (status != ZX_OK) {
-      FXL_LOG(ERROR) << "Failed to bind " << flat->paths.at(i)
-                     << " to namespace: " << zx_status_get_string(status);
+      FX_LOGF(ERROR, LOG_TAG, "Failed to bind %s to namespace: %s",
+              flat->paths.at(i).c_str(), zx_status_get_string(status));
       zx_handle_close(dir_handle);
       return false;
     }
@@ -215,7 +216,7 @@
   for (size_t start = 0; start < manifest.size();) {
     size_t end = str.find("\n", start);
     if (end == std::string::npos) {
-      FXL_LOG(ERROR) << "Malformed manifest";
+      FX_LOG(ERROR, LOG_TAG, "Malformed manifest");
       Dart_ExitScope();
       return false;
     }
@@ -225,13 +226,14 @@
 
     MappedResource kernel;
     if (!MappedResource::LoadFromNamespace(namespace_, path, kernel)) {
-      FXL_LOG(ERROR) << "Failed to find kernel: " << path;
+      FX_LOGF(ERROR, LOG_TAG, "Failed to find kernel: %s", path.c_str());
       Dart_ExitScope();
       return false;
     }
     library = Dart_LoadLibraryFromKernel(kernel.address(), kernel.size());
     if (Dart_IsError(library)) {
-      FXL_LOG(ERROR) << "Failed to load kernel: " << Dart_GetError(library);
+      FX_LOGF(ERROR, LOG_TAG, "Failed to load kernel: %s",
+              Dart_GetError(library));
       Dart_ExitScope();
       return false;
     }
@@ -242,7 +244,8 @@
 
   Dart_Handle result = Dart_FinalizeLoading(false);
   if (Dart_IsError(result)) {
-    FXL_LOG(ERROR) << "Failed to FinalizeLoading: " << Dart_GetError(result);
+    FX_LOGF(ERROR, LOG_TAG, "Failed to FinalizeLoading: %s",
+            Dart_GetError(result));
     Dart_ExitScope();
     return false;
   }
@@ -297,8 +300,8 @@
   int outfd = -1;
   zx_status_t status = fdio_fd_create(fd->handle0.release(), &outfd);
   if (status != ZX_OK) {
-    FXL_LOG(ERROR) << "Failed to extract output fd: "
-                   << zx_status_get_string(status);
+    FX_LOGF(ERROR, LOG_TAG, "Failed to extract output fd: %s",
+            zx_status_get_string(status));
     return -1;
   }
   return outfd;
@@ -323,7 +326,7 @@
       isolate_snapshot_instructions, shared_snapshot_data,
       shared_snapshot_instructions, nullptr /* flags */, state, &error);
   if (!isolate_) {
-    FXL_LOG(ERROR) << "Dart_CreateIsolate failed: " << error;
+    FX_LOGF(ERROR, LOG_TAG, "Dart_CreateIsolate failed: %s", error);
     return false;
   }
 
@@ -379,7 +382,7 @@
   if (error != nullptr) {
     Dart_EnterIsolate(isolate_);
     Dart_ShutdownIsolate();
-    FXL_LOG(ERROR) << "Unable to make isolate runnable: " << error;
+    FX_LOGF(ERROR, LOG_TAG, "Unable to make isolate runnable: %s", error);
     free(error);
     return false;
   }
@@ -389,8 +392,8 @@
   Dart_Handle dart_arguments =
       Dart_NewListOf(Dart_CoreType_String, arguments.size());
   if (Dart_IsError(dart_arguments)) {
-    FXL_LOG(ERROR) << "Failed to allocate Dart arguments list: "
-                   << Dart_GetError(dart_arguments);
+    FX_LOGF(ERROR, LOG_TAG, "Failed to allocate Dart arguments list: %s",
+            Dart_GetError(dart_arguments));
     Dart_ExitScope();
     return false;
   }
@@ -404,12 +407,13 @@
   };
 
   Dart_Handle main_result =
-      Dart_Invoke(Dart_RootLibrary(), ToDart("main"), arraysize(argv), argv);
+      Dart_Invoke(Dart_RootLibrary(), ToDart("main"),
+                  dart_utils::ArraySize(argv), argv);
   if (Dart_IsError(main_result)) {
     auto dart_state = tonic::DartState::Current();
     if (!dart_state->has_set_return_code()) {
       // The program hasn't set a return code meaning this exit is unexpected.
-      FXL_LOG(ERROR) << Dart_GetError(main_result);
+      FX_LOG(ERROR, LOG_TAG, Dart_GetError(main_result));
       return_code_ = tonic::GetErrorExitCode(main_result);
 
       dart_utils::HandleIfException(runner_incoming_services_, url_,
@@ -474,7 +478,8 @@
   zx_status_t status =
       idle_timer_.set(idle_start_ + kIdleWaitDuration, kIdleSlack);
   if (status != ZX_OK) {
-    FXL_LOG(INFO) << "Idle timer set failed: " << zx_status_get_string(status);
+    FX_LOGF(INFO, LOG_TAG, "Idle timer set failed: %s",
+            zx_status_get_string(status));
   }
 }
 
@@ -500,8 +505,8 @@
     // Early wakeup or message pushed idle time forward: reschedule.
     zx_status_t status = idle_timer_.set(deadline, kIdleSlack);
     if (status != ZX_OK) {
-      FXL_LOG(INFO) << "Idle timer set failed: "
-                    << zx_status_get_string(status);
+      FX_LOGF(INFO, LOG_TAG, "Idle timer set failed: %s",
+              zx_status_get_string(status));
     }
   }
   wait->Begin(dispatcher);  // ignore errors
diff --git a/runtime/dart_runner/dart_component_controller.h b/runtime/dart_runner/dart_component_controller.h
index 0acb2c0..007542c 100644
--- a/runtime/dart_runner/dart_component_controller.h
+++ b/runtime/dart_runner/dart_component_controller.h
@@ -16,7 +16,6 @@
 #include <lib/zx/timer.h>
 
 #include "lib/fidl/cpp/binding.h"
-#include "lib/fxl/macros.h"
 #include "third_party/dart/runtime/include/dart_api.h"
 #include "topaz/runtime/dart_runner/mapped_resource.h"
 
@@ -88,7 +87,9 @@
                     &DartComponentController::OnIdleTimer>
       idle_wait_{this};
 
-  FXL_DISALLOW_COPY_AND_ASSIGN(DartComponentController);
+  // Disallow copy and assignment.
+  DartComponentController(const DartComponentController&) = delete;
+  DartComponentController& operator=(const DartComponentController&) = delete;
 };
 
 }  // namespace dart_runner
diff --git a/runtime/dart_runner/dart_runner.cc b/runtime/dart_runner/dart_runner.cc
index ece12e6..d23c4f7 100644
--- a/runtime/dart_runner/dart_runner.cc
+++ b/runtime/dart_runner/dart_runner.cc
@@ -7,6 +7,7 @@
 #include <errno.h>
 #include <lib/async-loop/loop.h>
 #include <lib/async/default.h>
+#include <lib/syslog/global.h>
 #include <sys/stat.h>
 #include <trace/event.h>
 #include <zircon/status.h>
@@ -15,13 +16,13 @@
 #include <thread>
 #include <utility>
 
-#include "lib/fxl/arraysize.h"
-#include "lib/fxl/logging.h"
 #include "third_party/dart/runtime/include/bin/dart_io_api.h"
 #include "third_party/tonic/dart_microtask_queue.h"
 #include "third_party/tonic/dart_state.h"
+#include "topaz/runtime/dart/utils/inlines.h"
 #include "topaz/runtime/dart/utils/vmservice_object.h"
 #include "topaz/runtime/dart_runner/dart_component_controller.h"
+#include "topaz/runtime/dart_runner/logging.h"
 #include "topaz/runtime/dart_runner/service_isolate.h"
 
 #if defined(AOT_RUNTIME)
@@ -139,9 +140,10 @@
 
   dart::bin::BootstrapDartIo();
 
-  char* error = Dart_SetVMFlags(arraysize(kDartVMArgs), kDartVMArgs);
+  char* error = Dart_SetVMFlags(dart_utils::ArraySize(kDartVMArgs),
+                                kDartVMArgs);
   if (error) {
-    FXL_LOG(FATAL) << "Dart_SetVMFlags failed: " << error;
+    FX_LOGF(FATAL, LOG_TAG, "Dart_SetVMFlags failed: %s", error);
   }
 
   Dart_InitializeParams params = {};
@@ -152,12 +154,12 @@
 #else
   if (!MappedResource::LoadFromNamespace(
           nullptr, "pkg/data/vm_snapshot_data.bin", vm_snapshot_data_)) {
-    FXL_LOG(FATAL) << "Failed to load vm snapshot data";
+    FX_LOG(FATAL, LOG_TAG, "Failed to load vm snapshot data");
   }
   if (!MappedResource::LoadFromNamespace(
           nullptr, "pkg/data/vm_snapshot_instructions.bin",
           vm_snapshot_instructions_, true /* executable */)) {
-    FXL_LOG(FATAL) << "Failed to load vm snapshot instructions";
+    FX_LOG(FATAL, LOG_TAG, "Failed to load vm snapshot instructions");
   }
   params.vm_snapshot_data = vm_snapshot_data_.address();
   params.vm_snapshot_instructions = vm_snapshot_instructions_.address();
@@ -171,13 +173,13 @@
 #endif
   error = Dart_Initialize(&params);
   if (error)
-    FXL_LOG(FATAL) << "Dart_Initialize failed: " << error;
+    FX_LOGF(FATAL, LOG_TAG, "Dart_Initialize failed: %s", error);
 }
 
 DartRunner::~DartRunner() {
   char* error = Dart_Cleanup();
   if (error)
-    FXL_LOG(FATAL) << "Dart_Cleanup failed: " << error;
+    FX_LOGF(FATAL, LOG_TAG, "Dart_Cleanup failed: %s", error);
 }
 
 void DartRunner::StartComponent(
diff --git a/runtime/dart_runner/dart_runner.h b/runtime/dart_runner/dart_runner.h
index 67e04a4..232dc5c 100644
--- a/runtime/dart_runner/dart_runner.h
+++ b/runtime/dart_runner/dart_runner.h
@@ -9,7 +9,6 @@
 #include <lib/fidl/cpp/binding_set.h>
 #include <lib/sys/cpp/component_context.h>
 
-#include "lib/fxl/macros.h"
 #include "topaz/runtime/dart_runner/mapped_resource.h"
 
 namespace dart_runner {
@@ -34,7 +33,9 @@
   MappedResource vm_snapshot_instructions_;
 #endif
 
-  FXL_DISALLOW_COPY_AND_ASSIGN(DartRunner);
+  // Disallow copy and assignment.
+  DartRunner(const DartRunner&) = delete;
+  DartRunner& operator=(const DartRunner&) = delete;
 };
 
 }  // namespace dart_runner
diff --git a/runtime/dart_runner/logging.h b/runtime/dart_runner/logging.h
new file mode 100644
index 0000000..9d4068a
--- /dev/null
+++ b/runtime/dart_runner/logging.h
@@ -0,0 +1,15 @@
+// Copyright 2019 The Fuchsia Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef TOPAZ_RUNTIME_DART_RUNNER_LOGGING_H_
+#define TOPAZ_RUNTIME_DART_RUNNER_LOGGING_H_
+
+namespace dart_runner {
+
+// Use to mark logs published via the syslog API.
+#define LOG_TAG "dart-runner"
+
+}  // namespace dart_runner
+
+#endif  // TOPAZ_RUNTIME_DART_RUNNER_LOGGING_H_
diff --git a/runtime/dart_runner/mapped_resource.cc b/runtime/dart_runner/mapped_resource.cc
index 0ca3794..7d46f5d 100644
--- a/runtime/dart_runner/mapped_resource.cc
+++ b/runtime/dart_runner/mapped_resource.cc
@@ -10,9 +10,11 @@
 #include <trace/event.h>
 #include <zircon/status.h>
 
-#include "lib/fxl/logging.h"
+#include "topaz/runtime/dart/utils/inlines.h"
 #include "topaz/runtime/dart/utils/vmo.h"
 
+#include "topaz/runtime/dart_runner/logging.h"
+
 namespace dart_runner {
 
 bool MappedResource::LoadFromNamespace(fdio_ns_t* namespc,
@@ -22,7 +24,7 @@
   TRACE_DURATION("dart", "LoadFromNamespace", "path", path);
 
   // openat of a path with a leading '/' ignores the namespace fd.
-  FXL_CHECK(path[0] != '/');
+  dart_utils::Check(path[0] != '/', LOG_TAG);
 
   fuchsia::mem::Buffer resource_vmo;
   if (namespc == nullptr) {
@@ -48,8 +50,8 @@
     zx_status_t status =
         resource_vmo.vmo.replace_as_executable(zx::handle(), &resource_vmo.vmo);
     if (status != ZX_OK) {
-      FXL_LOG(ERROR) << "Failed to make VMO executable: "
-                     << zx_status_get_string(status);
+      FX_LOGF(ERROR, LOG_TAG, "Failed to make VMO executable: %s",
+              zx_status_get_string(status));
       return false;
     }
   }
@@ -72,8 +74,8 @@
   zx_status_t status = zx::vmar::root_self()->map(
       0, resource_vmo.vmo, 0, resource_vmo.size, flags, &addr);
   if (status != ZX_OK) {
-    FXL_LOG(ERROR) << "Failed to map " << path << ": "
-                   << zx_status_get_string(status);
+    FX_LOGF(ERROR, LOG_TAG, "Failed to map %s: %s", path.c_str(),
+            zx_status_get_string(status));
     return false;
   }
 
diff --git a/runtime/dart_runner/service_isolate.cc b/runtime/dart_runner/service_isolate.cc
index ab83857..7fefb5b 100644
--- a/runtime/dart_runner/service_isolate.cc
+++ b/runtime/dart_runner/service_isolate.cc
@@ -4,15 +4,17 @@
 
 #include "topaz/runtime/dart_runner/service_isolate.h"
 
-#include "lib/fxl/logging.h"
 #include "third_party/dart/runtime/include/bin/dart_io_api.h"
 #include "third_party/tonic/converter/dart_converter.h"
 #include "third_party/tonic/dart_library_natives.h"
 #include "third_party/tonic/dart_microtask_queue.h"
 #include "third_party/tonic/dart_state.h"
 #include "third_party/tonic/typed_data/uint8_list.h"
+#include "topaz/runtime/dart/utils/inlines.h"
+
 #include "topaz/runtime/dart_runner/builtin_libraries.h"
 #include "topaz/runtime/dart_runner/dart_component_controller.h"
+#include "topaz/runtime/dart_runner/logging.h"
 
 namespace dart_runner {
 namespace {
@@ -25,20 +27,20 @@
 
 Dart_NativeFunction GetNativeFunction(Dart_Handle name, int argument_count,
                                       bool* auto_setup_scope) {
-  FXL_CHECK(service_natives);
+  dart_utils::Check(service_natives, LOG_TAG);
   return service_natives->GetNativeFunction(name, argument_count,
                                             auto_setup_scope);
 }
 
 const uint8_t* GetSymbol(Dart_NativeFunction native_function) {
-  FXL_CHECK(service_natives);
+  dart_utils::Check(service_natives, LOG_TAG);
   return service_natives->GetSymbol(native_function);
 }
 
 #define SHUTDOWN_ON_ERROR(handle)           \
   if (Dart_IsError(handle)) {               \
     *error = strdup(Dart_GetError(handle)); \
-    FXL_LOG(ERROR) << *error;               \
+    FX_LOG(ERROR, LOG_TAG, *error);         \
     Dart_ExitScope();                       \
     Dart_ShutdownIsolate();                 \
     return nullptr;                         \
@@ -90,14 +92,14 @@
   if (!MappedResource::LoadFromNamespace(nullptr, snapshot_data_path,
                                          mapped_isolate_snapshot_data)) {
     *error = strdup("Failed to load snapshot for service isolate");
-    FXL_LOG(ERROR) << *error;
+    FX_LOG(ERROR, LOG_TAG, *error);
     return nullptr;
   }
   if (!MappedResource::LoadFromNamespace(nullptr, snapshot_instructions_path,
                                          mapped_isolate_snapshot_instructions,
                                          true /* executable */)) {
     *error = strdup("Failed to load snapshot for service isolate");
-    FXL_LOG(ERROR) << *error;
+    FX_LOG(ERROR, LOG_TAG, *error);
     return nullptr;
   }
 
@@ -106,14 +108,14 @@
           nullptr, "pkg/data/vmservice_shared_snapshot_data.bin",
           mapped_shared_snapshot_data)) {
     *error = strdup("Failed to load snapshot for service isolate");
-    FXL_LOG(ERROR) << *error;
+    FX_LOG(ERROR, LOG_TAG, *error);
     return nullptr;
   }
   if (!MappedResource::LoadFromNamespace(
           nullptr, "pkg/data/vmservice_shared_snapshot_instructions.bin",
           mapped_shared_snapshot_instructions, true /* executable */)) {
     *error = strdup("Failed to load snapshot for service isolate");
-    FXL_LOG(ERROR) << *error;
+    FX_LOG(ERROR, LOG_TAG, *error);
     return nullptr;
   }
 #endif
@@ -126,7 +128,7 @@
                          mapped_shared_snapshot_instructions.address(),
                          nullptr /* flags */, state, error);
   if (!isolate) {
-    FXL_LOG(ERROR) << "Dart_CreateIsolate failed: " << *error;
+    FX_LOGF(ERROR, LOG_TAG, "Dart_CreateIsolate failed: %s", *error);
     return nullptr;
   }
 
@@ -178,7 +180,7 @@
   Dart_ExitIsolate();
   *error = Dart_IsolateMakeRunnable(isolate);
   if (*error != nullptr) {
-    FXL_LOG(ERROR) << *error;
+    FX_LOG(ERROR, LOG_TAG, *error);
     Dart_EnterIsolate(isolate);
     Dart_ShutdownIsolate();
     return nullptr;
@@ -190,7 +192,7 @@
   MappedResource observatory_tar;
   if (!MappedResource::LoadFromNamespace(nullptr, "pkg/data/observatory.tar",
                                          observatory_tar)) {
-    FXL_LOG(ERROR) << "Failed to load Observatory assets";
+    FX_LOG(ERROR, LOG_TAG, "Failed to load Observatory assets");
     return nullptr;
   }
   // TODO(rmacnak): Should we avoid copying the tar? Or does the service library
diff --git a/runtime/flutter_runner/BUILD.gn b/runtime/flutter_runner/BUILD.gn
index cf3d189..dd5373f 100644
--- a/runtime/flutter_runner/BUILD.gn
+++ b/runtime/flutter_runner/BUILD.gn
@@ -75,6 +75,7 @@
       "fuchsia_font_manager.h",
       "isolate_configurator.cc",
       "isolate_configurator.h",
+      "logging.h",
       "loop.cc",
       "loop.h",
       "main.cc",
@@ -132,7 +133,6 @@
              "//sdk/fidl/fuchsia.ui.app",
              "//sdk/fidl/fuchsia.ui.input",
              "//sdk/fidl/fuchsia.ui.viewsv1",
-             "//garnet/public/lib/fxl",
              "//garnet/public/lib/vulkan",
              "//sdk/fidl/fuchsia.modular",
              "//sdk/lib/sys/cpp",
@@ -147,10 +147,13 @@
              "//topaz/public/dart-pkg/fuchsia",
              "//topaz/public/lib/ui/flutter/sdk_ext",
              "//topaz/runtime/dart/utils",
+             "//topaz/runtime/dart/utils:inlines",
+             "//topaz/runtime/dart/utils:files",
              "//topaz/runtime/dart/utils:vmo",
              "//zircon/public/fidl/fuchsia-io",
              "//zircon/public/lib/async-cpp",
              "//zircon/public/lib/async-loop-cpp",
+             "//zircon/public/lib/syslog",
              "//zircon/public/lib/trace",
              "//zircon/public/lib/trace-provider",
              "//zircon/public/lib/zx",
@@ -383,6 +386,7 @@
     "fuchsia_font_manager.cc",
     "fuchsia_font_manager.h",
     "fuchsia_font_manager_unittest.cc",
+    "logging.h",
   ]
 
   deps = [
@@ -393,6 +397,7 @@
     "//third_party/googletest:gtest_main",
     "//third_party/icu",
     "//third_party/skia",
+    "//topaz/runtime/dart/utils:inlines",
     "//topaz/runtime/dart/utils:vmo",
     "//zircon/public/lib/fdio",
     "//zircon/public/lib/trace",
diff --git a/runtime/flutter_runner/component.cc b/runtime/flutter_runner/component.cc
index 81650ff..abc16d6 100644
--- a/runtime/flutter_runner/component.cc
+++ b/runtime/flutter_runner/component.cc
@@ -21,15 +21,15 @@
 
 #include "flutter/fml/synchronization/waitable_event.h"
 #include "flutter/shell/common/switches.h"
-#include "lib/fxl/command_line.h"
-#include "src/lib/files/file.h"
-#include "loop.h"
-#include "service_provider_dir.h"
-#include "task_observers.h"
+#include "topaz/runtime/dart/utils/files.h"
 #include "topaz/runtime/dart/utils/handle_exception.h"
 #include "topaz/runtime/dart/utils/tempfs.h"
 #include "topaz/runtime/dart/utils/vmo.h"
 
+#include "loop.h"
+#include "service_provider_dir.h"
+#include "task_observers.h"
+
 namespace flutter {
 
 constexpr char kDataKey[] = "data";
@@ -228,10 +228,10 @@
     // Check if we can use the snapshot with the framework already loaded.
     std::string runner_framework;
     std::string app_framework;
-    if (files::ReadFileToString("pkg/data/runner.frameworkversion",
-                                &runner_framework) &&
-        files::ReadFileToStringAt(application_assets_directory_.get(),
-                                  "app.frameworkversion", &app_framework) &&
+    if (dart_utils::ReadFileToString("pkg/data/runner.frameworkversion",
+                                     &runner_framework) &&
+        dart_utils::ReadFileToStringAt(application_assets_directory_.get(),
+                                      "app.frameworkversion", &app_framework) &&
         (runner_framework.compare(app_framework) == 0)) {
       settings_.vm_snapshot_data_path =
           "pkg/data/framework_vm_snapshot_data.bin";
diff --git a/runtime/flutter_runner/component.h b/runtime/flutter_runner/component.h
index 4acf2f9..aaf80ba 100644
--- a/runtime/flutter_runner/component.h
+++ b/runtime/flutter_runner/component.h
@@ -25,7 +25,6 @@
 #include "flutter/fml/macros.h"
 #include "lib/fidl/cpp/binding_set.h"
 #include "lib/fidl/cpp/interface_request.h"
-#include "src/lib/files/unique_fd.h"
 #include "unique_fdio_ns.h"
 
 namespace flutter {
diff --git a/runtime/flutter_runner/engine.cc b/runtime/flutter_runner/engine.cc
index 527f47f..3df4d8a 100644
--- a/runtime/flutter_runner/engine.cc
+++ b/runtime/flutter_runner/engine.cc
@@ -13,9 +13,9 @@
 #include "flutter/fml/task_runner.h"
 #include "flutter/shell/common/rasterizer.h"
 #include "flutter/shell/common/run_configuration.h"
-#include "fuchsia_font_manager.h"
-#include "src/lib/files/file.h"
+#include "topaz/runtime/dart/utils/files.h"
 
+#include "fuchsia_font_manager.h"
 #include "loop.h"
 #include "platform_view.h"
 #include "task_runner_adapter.h"
@@ -382,9 +382,9 @@
     Dart_Handle result = Dart_SaveTypeFeedback(&feedback, &feedback_length);
     tonic::LogIfError(result);
     const std::string kTypeFeedbackFile = "/data/dart_type_feedback.bin";
-    if (files::WriteFile(kTypeFeedbackFile,
-                         reinterpret_cast<const char*>(feedback),
-                         feedback_length)) {
+    if (dart_utils::WriteFile(kTypeFeedbackFile,
+                              reinterpret_cast<const char*>(feedback),
+                              feedback_length)) {
       FML_LOG(INFO) << "Dart type feedback written to "
                      << kTypeFeedbackFile;
     } else {
diff --git a/runtime/flutter_runner/engine.h b/runtime/flutter_runner/engine.h
index 352cb47..40b0cc0 100644
--- a/runtime/flutter_runner/engine.h
+++ b/runtime/flutter_runner/engine.h
@@ -15,7 +15,6 @@
 #include "flutter/fml/macros.h"
 #include "flutter/shell/common/shell.h"
 #include "isolate_configurator.h"
-#include "lib/fxl/memory/weak_ptr.h"
 #include "lib/ui/flutter/sdk_ext/src/natives.h"
 
 namespace flutter {
diff --git a/runtime/flutter_runner/fuchsia_font_manager.cc b/runtime/flutter_runner/fuchsia_font_manager.cc
index 26ff6e5..746288a 100644
--- a/runtime/flutter_runner/fuchsia_font_manager.cc
+++ b/runtime/flutter_runner/fuchsia_font_manager.cc
@@ -22,12 +22,12 @@
 
 #include <unordered_map>
 
-#include "lib/fxl/logging.h"
-#include "lib/fxl/macros.h"
-#include "lib/fxl/memory/weak_ptr.h"
 #include "third_party/icu/source/common/unicode/uchar.h"
+#include "topaz/runtime/dart/utils/inlines.h"
 #include "topaz/runtime/dart/utils/vmo.h"
 
+#include "topaz/runtime/flutter_runner/logging.h"
+
 namespace txt {
 
 namespace {
@@ -53,7 +53,7 @@
 
 void ReleaseSkData(const void* buffer, void* context) {
   auto skdata_context = reinterpret_cast<ReleaseSkDataContext*>(context);
-  FXL_DCHECK(skdata_context);
+  DEBUG_CHECK(skdata_context != nullptr, LOG_TAG, "");
   UnmapMemory(buffer, skdata_context->buffer_size);
   skdata_context->release_proc();
   delete skdata_context;
@@ -105,7 +105,7 @@
 
 fidl::VectorPtr<std::string> BuildLanguageList(const char* bcp47[],
                                                int bcp47_count) {
-  FXL_DCHECK(bcp47 != nullptr || bcp47_count == 0);
+  DEBUG_CHECK(bcp47 != nullptr || bcp47_count == 0, LOG_TAG, "");
   auto languages = fidl::VectorPtr<std::string>::New(0);
   for (int i = 0; i < bcp47_count; i++) {
     languages.push_back(bcp47[i]);
@@ -121,7 +121,7 @@
 
 class FuchsiaFontManager::TypefaceCache {
  public:
-  TypefaceCache() : weak_factory_(this) {}
+  TypefaceCache() {}
   ~TypefaceCache();
 
   // Get an SkTypeface with the given buffer id, font index, and buffer
@@ -129,6 +129,9 @@
   sk_sp<SkTypeface> GetOrCreateTypeface(
       int buffer_id, int font_index, const fuchsia::mem::Buffer& buffer) const;
 
+  // Callback called when an SkData with the given buffer id is deleted.
+  void OnSkDataDeleted(int buffer_id) const;
+
  private:
   // Used to identify an SkTypeface in the cache.
   struct TypefaceId {
@@ -155,9 +158,6 @@
     }
   };
 
-  // Callback called when an SkData with the given buffer id is deleted.
-  void OnSkDataDeleted(int buffer_id) const;
-
   // Try to get an SkData with the given buffer id from the cache. If an
   // SkData is not found, create it and add it to the cache.
   sk_sp<SkData> GetOrCreateSkData(int buffer_id,
@@ -169,12 +169,35 @@
 
   mutable std::unordered_map<TypefaceId, SkTypeface*, TypefaceIdHash>
       typeface_cache_;
-  mutable std::unordered_map<int, SkData*> buffer_cache_;
+  mutable std::unordered_map<int, std::shared_ptr<BufferHolder>> buffer_cache_;
 
-  // Must be last.
-  mutable fxl::WeakPtrFactory<TypefaceCache> weak_factory_;
+  // Disallow copy and assignment.
+  TypefaceCache(const TypefaceCache&) = delete;
+  TypefaceCache& operator=(const TypefaceCache&) = delete;
+};
 
-  FXL_DISALLOW_COPY_AND_ASSIGN(TypefaceCache);
+class FuchsiaFontManager::BufferHolder {
+ public:
+  BufferHolder(const TypefaceCache* cache, int buffer_id) :
+      cache_(cache), buffer_id_(buffer_id) {}
+  ~BufferHolder() {}
+
+  void SetData(SkData* data) { data_ = data; }
+
+  SkData* GetData() const { return data_; }
+
+  void OnDataDeleted() {
+    cache_->OnSkDataDeleted(buffer_id_);
+  }
+
+ private:
+  const TypefaceCache* cache_;
+  int buffer_id_;
+  SkData* data_;
+
+  // Disallow copy and assignment.
+  BufferHolder(const BufferHolder&) = delete;
+  BufferHolder& operator=(const BufferHolder&) = delete;
 };
 
 FuchsiaFontManager::TypefaceCache::~TypefaceCache() {
@@ -185,25 +208,27 @@
 
 void FuchsiaFontManager::TypefaceCache::OnSkDataDeleted(int buffer_id) const {
   bool was_found = buffer_cache_.erase(buffer_id) != 0;
-  FXL_DCHECK(was_found);
+  DEBUG_CHECK(was_found, LOG_TAG, "");
 }
 
 sk_sp<SkData> FuchsiaFontManager::TypefaceCache::GetOrCreateSkData(
     int buffer_id, const fuchsia::mem::Buffer& buffer) const {
   auto iter = buffer_cache_.find(buffer_id);
   if (iter != buffer_cache_.end()) {
-    return sk_ref_sp(iter->second);
+    return sk_ref_sp(iter->second->GetData());
   }
-  auto weak_this = weak_factory_.GetWeakPtr();
-  auto data = MakeSkDataFromBuffer(buffer, buffer_id, [weak_this, buffer_id]() {
-    if (weak_this) {
-      weak_this->OnSkDataDeleted(buffer_id);
+  auto holder = std::make_shared<BufferHolder>(this, buffer_id);
+  std::weak_ptr<BufferHolder> weak_holder = holder;
+  auto data = MakeSkDataFromBuffer(buffer, buffer_id, [weak_holder]() {
+    if (auto holder = weak_holder.lock()) {
+      holder->OnDataDeleted();
     }
   });
   if (!data) {
     return nullptr;
   }
-  buffer_cache_[buffer_id] = data.get();
+  holder->SetData(data.get());
+  buffer_cache_[buffer_id] = std::move(holder);
   return data;
 }
 
@@ -247,7 +272,8 @@
   int count() override { return styles_.size(); }
 
   void getStyle(int index, SkFontStyle* style, SkString* style_name) override {
-    FXL_DCHECK(index >= 0 && index < static_cast<int>(styles_.size()));
+    DEBUG_CHECK(
+        index >= 0 && index < static_cast<int>(styles_.size()), LOG_TAG, "");
     if (style)
       *style = styles_[index];
 
@@ -257,7 +283,8 @@
   }
 
   SkTypeface* createTypeface(int index) override {
-    FXL_DCHECK(index >= 0 && index < static_cast<int>(styles_.size()));
+    DEBUG_CHECK(
+        index >= 0 && index < static_cast<int>(styles_.size()), LOG_TAG, "");
 
     if (typefaces_.empty())
       typefaces_.resize(styles_.size());
@@ -283,7 +310,9 @@
   std::vector<SkFontStyle> styles_;
   std::vector<sk_sp<SkTypeface>> typefaces_;
 
-  FXL_DISALLOW_COPY_AND_ASSIGN(FontStyleSet);
+  // Disallow copy and assignment.
+  FontStyleSet(const FontStyleSet&) = delete;
+  FontStyleSet& operator=(const FontStyleSet&) = delete;
 };
 
 FuchsiaFontManager::FuchsiaFontManager(fuchsia::fonts::ProviderSyncPtr provider)
@@ -293,17 +322,17 @@
 FuchsiaFontManager::~FuchsiaFontManager() = default;
 
 int FuchsiaFontManager::onCountFamilies() const {
-  FXL_DCHECK(false);
+  DEBUG_CHECK(false, LOG_TAG, "");
   return 0;
 }
 
 void FuchsiaFontManager::onGetFamilyName(int index,
                                          SkString* familyName) const {
-  FXL_DCHECK(false);
+  DEBUG_CHECK(false, LOG_TAG, "");
 }
 
 SkFontStyleSet* FuchsiaFontManager::onCreateStyleSet(int index) const {
-  FXL_DCHECK(false);
+  DEBUG_CHECK(false, LOG_TAG, "");
   return nullptr;
 }
 
@@ -312,9 +341,10 @@
   fuchsia::fonts::FamilyInfoPtr family_info;
   int err = font_provider_->GetFamilyInfo(family_name, &family_info);
   if (err != ZX_OK) {
-    FXL_DLOG(ERROR) << "Error fetching family from provider [err=" << err
-                    << "]. Did you run Flutter in an environment that"
-                    << " has a font manager? ";
+#ifndef NDEBUG
+    FX_LOGF(ERROR, LOG_TAG, "Error fetching family from provider [err=%d]. Did "
+            "you run Flutter in an environment that has a font manager?", err);
+#endif
     return nullptr;
   }
 
@@ -347,37 +377,37 @@
 
 SkTypeface* FuchsiaFontManager::onMatchFaceStyle(const SkTypeface*,
                                                  const SkFontStyle&) const {
-  FXL_DCHECK(false);
+  DEBUG_CHECK(false, LOG_TAG, "");
   return nullptr;
 }
 
 sk_sp<SkTypeface> FuchsiaFontManager::onMakeFromData(sk_sp<SkData>,
                                                      int ttcIndex) const {
-  FXL_DCHECK(false);
+  DEBUG_CHECK(false, LOG_TAG, "");
   return nullptr;
 }
 
 sk_sp<SkTypeface> FuchsiaFontManager::onMakeFromStreamIndex(
     std::unique_ptr<SkStreamAsset>, int ttcIndex) const {
-  FXL_DCHECK(false);
+  DEBUG_CHECK(false, LOG_TAG, "");
   return nullptr;
 }
 
 sk_sp<SkTypeface> FuchsiaFontManager::onMakeFromStreamArgs(
     std::unique_ptr<SkStreamAsset>, const SkFontArguments&) const {
-  FXL_DCHECK(false);
+  DEBUG_CHECK(false, LOG_TAG, "");
   return nullptr;
 }
 
 sk_sp<SkTypeface> FuchsiaFontManager::onMakeFromFile(const char path[],
                                                      int ttcIndex) const {
-  FXL_DCHECK(false);
+  DEBUG_CHECK(false, LOG_TAG, "");
   return nullptr;
 }
 
 sk_sp<SkTypeface> FuchsiaFontManager::onLegacyMakeTypeface(
     const char familyName[], SkFontStyle) const {
-  FXL_DCHECK(false);
+  DEBUG_CHECK(false, LOG_TAG, "");
   return nullptr;
 }
 
@@ -397,9 +427,10 @@
   fuchsia::fonts::ResponsePtr response;
   int err = font_provider_->GetFont(std::move(request), &response);
   if (err != ZX_OK) {
-    FXL_DLOG(ERROR) << "Error fetching font from provider [err=" << err
-                    << "]. Did you run Flutter in an environment that"
-                    << " has a font manager? ";
+#ifndef NDEBUG
+    FX_LOGF(ERROR, LOG_TAG, "Error fetching font from provider [err=%d]. Did "
+            "you run Flutter in an environment that has a font manager?", err);
+#endif
     return nullptr;
   }
 
diff --git a/runtime/flutter_runner/fuchsia_font_manager.h b/runtime/flutter_runner/fuchsia_font_manager.h
index a6c6ebe..56016aa 100644
--- a/runtime/flutter_runner/fuchsia_font_manager.h
+++ b/runtime/flutter_runner/fuchsia_font_manager.h
@@ -20,7 +20,6 @@
 #include <fuchsia/fonts/cpp/fidl.h>
 #include <memory>
 
-#include "lib/fxl/macros.h"
 #include "third_party/skia/include/core/SkFontMgr.h"
 #include "third_party/skia/include/core/SkStream.h"
 #include "third_party/skia/include/core/SkTypeface.h"
@@ -79,6 +78,7 @@
                                          SkFontStyle) const override;
 
  private:
+  class BufferHolder;
   class TypefaceCache;
   class FontStyleSet;
   friend class FontStyleSet;
@@ -91,7 +91,9 @@
   mutable fuchsia::fonts::ProviderSyncPtr font_provider_;
   std::unique_ptr<TypefaceCache> typeface_cache_;
 
-  FXL_DISALLOW_COPY_AND_ASSIGN(FuchsiaFontManager);
+  // Disallow copy and assignment.
+  FuchsiaFontManager(const FuchsiaFontManager&) = delete;
+  FuchsiaFontManager& operator=(const FuchsiaFontManager&) = delete;
 };
 
 }  // namespace txt
diff --git a/runtime/flutter_runner/logging.h b/runtime/flutter_runner/logging.h
new file mode 100644
index 0000000..243058d
--- /dev/null
+++ b/runtime/flutter_runner/logging.h
@@ -0,0 +1,15 @@
+// Copyright 2019 The Fuchsia Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef TOPAZ_RUNTIME_FLUTTER_RUNNER_LOGGING_H_
+#define TOPAZ_RUNTIME_FLUTTER_RUNNER_LOGGING_H_
+
+namespace flutter {
+
+// Use to mark logs published via the syslog API.
+#define LOG_TAG "flutter-runner"
+
+}  // namespace flutter_runner
+
+#endif  // TOPAZ_RUNTIME_FLUTTER_RUNNER_LOGGING_H_
diff --git a/runtime/flutter_runner/platform_view.cc b/runtime/flutter_runner/platform_view.cc
index bc46ba9..f21d7f7 100644
--- a/runtime/flutter_runner/platform_view.cc
+++ b/runtime/flutter_runner/platform_view.cc
@@ -8,12 +8,16 @@
 
 #include <sstream>
 
+#include <trace/event.h>
+
 #include "flutter/lib/ui/window/pointer_data.h"
 #include "rapidjson/document.h"
 #include "rapidjson/stringbuffer.h"
 #include "rapidjson/writer.h"
-#include "vsync_waiter.h"
-#include "trace/event.h"
+#include "topaz/runtime/dart/utils/inlines.h"
+
+#include "topaz/runtime/flutter_runner/logging.h"
+#include "topaz/runtime/flutter_runner/vsync_waiter.h"
 
 namespace flutter {
 
@@ -419,9 +423,9 @@
                    "(fuchsia.ui.gfx.ViewStateChanged).";
             break;
           case fuchsia::ui::gfx::Event::Tag::Invalid:
-            FXL_DCHECK(false)
-                << "Flutter PlatformView::OnScenicEvent: Got an invalid GFX "
-                   "event.";
+            DEBUG_CHECK(false, LOG_TAG,
+                        "Flutter PlatformView::OnScenicEvent: Got "
+                        "an invalid GFX event.");
             break;
           default:
             FML_LOG(WARNING)
@@ -608,7 +612,7 @@
 }
 
 void PlatformView::ActivateIme() {
-  FXL_DCHECK(last_text_state_);
+  DEBUG_CHECK(last_text_state_ != nullptr, LOG_TAG, "");
 
   text_sync_service_->GetInputMethodEditor(
       fuchsia::ui::input::KeyboardType::TEXT,       // keyboard type
diff --git a/runtime/flutter_runner/semantics_bridge.cc b/runtime/flutter_runner/semantics_bridge.cc
index e7586b6..eb72549 100644
--- a/runtime/flutter_runner/semantics_bridge.cc
+++ b/runtime/flutter_runner/semantics_bridge.cc
@@ -4,6 +4,12 @@
 
 #include "topaz/runtime/flutter_runner/semantics_bridge.h"
 
+#include <lib/syslog/global.h>
+
+#include "topaz/runtime/dart/utils/inlines.h"
+
+#include "topaz/runtime/flutter_runner/logging.h"
+
 namespace flutter {
 
 // Helper function to convert SkRect, Flutter semantics node bounding box
@@ -23,7 +29,7 @@
 // format to fuchsia::ui::gfx::mat4, the Fidl equivalent.
 fuchsia::ui::gfx::mat4 WrapSkMatrix(SkMatrix44& args) {
   fuchsia::ui::gfx::mat4 value;
-  FXL_DCHECK(value.matrix.count() == 16);
+  DEBUG_CHECK(value.matrix.count() == 16, LOG_TAG, "");
   float* m = value.matrix.mutable_data();
   args.asColMajorf(m);
   return value;
@@ -61,7 +67,7 @@
                                  blink::LogicalMetrics* metrics)
     : binding_(this), platform_view_(platform_view), metrics_(metrics) {
   root_.set_error_handler([this](zx_status_t status) {
-    FXL_LOG(INFO) << "A11y bridge disconnected from a11y manager";
+    FX_LOG(INFO, LOG_TAG, "A11y bridge disconnected from a11y manager");
     binding_.Unbind();
     root_.Unbind();
     platform_view_->SetSemanticsEnabled(false);
@@ -73,7 +79,7 @@
   a11y_toggle_.events().OnAccessibilityToggle =
       fit::bind_member(this, &SemanticsBridge::OnAccessibilityToggle);
   a11y_toggle_.set_error_handler([this](zx_status_t status) {
-    FXL_LOG(INFO) << "Disconnected from a11y toggle broadcaster.";
+    FX_LOG(INFO, LOG_TAG, "Disconnected from a11y toggle broadcaster.");
     binding_.Unbind();
     root_.Unbind();
     environment_set_ = false;
@@ -139,7 +145,7 @@
           node_id, blink::SemanticsAction::kTap, args);
       break;
     default:
-      FXL_LOG(ERROR) << "Accessibility action not supported";
+      FX_LOG(ERROR, LOG_TAG, "Accessibility action not supported");
   }
 }
 
diff --git a/runtime/flutter_runner/semantics_bridge.h b/runtime/flutter_runner/semantics_bridge.h
index fbc96d6..c966329 100644
--- a/runtime/flutter_runner/semantics_bridge.h
+++ b/runtime/flutter_runner/semantics_bridge.h
@@ -15,8 +15,6 @@
 #include "flutter/lib/ui/semantics/semantics_node.h"
 #include "flutter/lib/ui/window/viewport_metrics.h"
 #include "lib/fidl/cpp/binding_set.h"
-#include "lib/fxl/logging.h"
-#include "lib/fxl/macros.h"
 
 #include "flutter/shell/common/platform_view.h"
 
@@ -87,7 +85,9 @@
   // transform matrix when sent to the manager.
   blink::LogicalMetrics* metrics_;
 
-  FXL_DISALLOW_COPY_AND_ASSIGN(SemanticsBridge);
+  // Disallow copy and assignment.
+  SemanticsBridge(const SemanticsBridge&) = delete;
+  SemanticsBridge& operator=(const SemanticsBridge&) = delete;
 };
 
 }  // namespace flutter
diff --git a/runtime/flutter_runner/service_provider_dir.h b/runtime/flutter_runner/service_provider_dir.h
index 7bd59bc..bc58f1b 100644
--- a/runtime/flutter_runner/service_provider_dir.h
+++ b/runtime/flutter_runner/service_provider_dir.h
@@ -17,8 +17,6 @@
 #include <lib/vfs/cpp/service.h>
 
 #include "lib/fidl/cpp/binding_set.h"
-#include "lib/fxl/logging.h"
-#include "lib/fxl/macros.h"
 
 namespace flutter {
 
@@ -62,7 +60,9 @@
   mutable std::map<std::string,
                    std::unique_ptr<vfs::Service>> fallback_services_;
 
-  FXL_DISALLOW_COPY_AND_ASSIGN(ServiceProviderDir);
+   // Disallow copy and assignment.
+   ServiceProviderDir(const ServiceProviderDir&) = delete;
+   ServiceProviderDir& operator=(const ServiceProviderDir&) = delete;
 };
 
 }  // namespace flutter
diff --git a/runtime/flutter_runner/vsync_recorder.h b/runtime/flutter_runner/vsync_recorder.h
index 87d501c..52eb10b 100644
--- a/runtime/flutter_runner/vsync_recorder.h
+++ b/runtime/flutter_runner/vsync_recorder.h
@@ -9,7 +9,6 @@
 
 #include "flutter/fml/time/time_delta.h"
 #include "flutter/fml/time/time_point.h"
-#include "lib/fxl/macros.h"
 #include "lib/ui/scenic/cpp/session.h"
 
 namespace flutter {
@@ -40,7 +39,9 @@
 
   std::optional<fuchsia::images::PresentationInfo> last_presentation_info_;
 
-  FXL_DISALLOW_COPY_ASSIGN_AND_MOVE(VsyncRecorder);
+  // Disallow copy and assignment.
+  VsyncRecorder(const VsyncRecorder&) = delete;
+  VsyncRecorder& operator=(const VsyncRecorder&) = delete;
 };
 
 }  // namespace flutter
diff --git a/runtime/flutter_runner/vulkan_surface.cc b/runtime/flutter_runner/vulkan_surface.cc
index 2a42a23..338461e 100644
--- a/runtime/flutter_runner/vulkan_surface.cc
+++ b/runtime/flutter_runner/vulkan_surface.cc
@@ -9,11 +9,11 @@
 
 #include <algorithm>
 
-#include "lib/fxl/logging.h"
 #include "third_party/skia/include/core/SkCanvas.h"
 #include "third_party/skia/include/gpu/GrBackendSemaphore.h"
 #include "third_party/skia/include/gpu/GrBackendSurface.h"
 #include "third_party/skia/include/gpu/GrContext.h"
+#include "topaz/runtime/dart/utils/inlines.h"
 
 namespace flutter {
 
@@ -437,9 +437,10 @@
     return;
   }
 
-  FXL_CHECK(pending_on_writes_committed_ == nullptr)
-      << "Attempted to signal a write on the surface when the previous write "
-         "has not yet been acknowledged by the compositor.";
+  dart_utils::Check(pending_on_writes_committed_ == nullptr,
+                    "Attempted to signal a write on the surface when the "
+                    "previous write has not yet been acknowledged by the "
+                    "compositor.");
 
   pending_on_writes_committed_ = on_writes_committed;
 }
diff --git a/runtime/flutter_runner/vulkan_surface_producer.h b/runtime/flutter_runner/vulkan_surface_producer.h
index 778291c..3f0e028 100644
--- a/runtime/flutter_runner/vulkan_surface_producer.h
+++ b/runtime/flutter_runner/vulkan_surface_producer.h
@@ -6,6 +6,7 @@
 
 #include <lib/async/default.h>
 #include <lib/async/cpp/time.h>
+#include <lib/syslog/global.h>
 
 #include "flutter/flow/scene_update_context.h"
 #include "flutter/fml/macros.h"
@@ -13,11 +14,12 @@
 #include "flutter/vulkan/vulkan_device.h"
 #include "flutter/vulkan/vulkan_proc_table.h"
 #include "flutter/vulkan/vulkan_provider.h"
-#include "lib/fxl/logging.h"
 #include "lib/ui/scenic/cpp/resources.h"
 #include "lib/ui/scenic/cpp/session.h"
-#include "vulkan_surface.h"
-#include "vulkan_surface_pool.h"
+
+#include "topaz/runtime/flutter_runner/logging.h"
+#include "topaz/runtime/flutter_runner/vulkan_surface.h"
+#include "topaz/runtime/flutter_runner/vulkan_surface_pool.h"
 
 namespace flutter {
 
@@ -60,8 +62,9 @@
 
   void OnSessionSizeChangeHint(float width_change_factor,
                                float height_change_factor) {
-    FXL_LOG(INFO) << "VulkanSurfaceProducer:OnSessionSizeChangeHint "
-                  << width_change_factor << ", " << height_change_factor;
+    FX_LOGF(INFO, LOG_TAG,
+            "VulkanSurfaceProducer:OnSessionSizeChangeHint %f, %f",
+            width_change_factor, height_change_factor);
   }
 
  private:
@@ -93,7 +96,9 @@
 
   bool Initialize(scenic::Session* scenic_session);
 
-  FML_DISALLOW_COPY_AND_ASSIGN(VulkanSurfaceProducer);
+  // Disallow copy and assignment.
+  VulkanSurfaceProducer(const VulkanSurfaceProducer&) = delete;
+  VulkanSurfaceProducer& operator=(const VulkanSurfaceProducer&) = delete;
 };
 
 }  // namespace flutter