diff --git a/connections/c/BUILD b/connections/c/BUILD index cfa2297c..e197a1a0 100644 --- a/connections/c/BUILD +++ b/connections/c/BUILD @@ -52,7 +52,12 @@ cc_library( "@com_google_absl//absl/container:flat_hash_map", "@com_google_absl//absl/strings", "@com_google_absl//absl/types:span", - ], + ] + select({ + "@platforms//os:platform_ios": [ + "//internal/platform/implementation/apple:logger_writer", + ], + "//conditions:default": [], + }), ) # iOS only. diff --git a/connections/c/nc.cc b/connections/c/nc.cc index 89c2f5ee..882928b2 100644 --- a/connections/c/nc.cc +++ b/connections/c/nc.cc @@ -49,6 +49,9 @@ #include "internal/platform/byte_array.h" #include "internal/platform/file.h" #include "internal/platform/logging.h" +#if TARGET_OS_IOS +#include "internal/platform/implementation/apple/nearby_logger_writer.h" +#endif // TARGET_OS_IOS namespace nearby::connections { class Core; @@ -221,6 +224,12 @@ NcContext* GetContext(NC_INSTANCE instance) { NC_INSTANCE NcCreateService() { NcContext nc_context; +#if TARGET_OS_IOS +#if DEBUG + absl::SetGlobalVLogLevel(1); +#endif // DEBUG + ::nearby::apple::EnableNearbyLoggerWriter(); +#endif // TARGET_OS_IOS #if defined(NC_IOS_SDK) nearby::NearbyFlags::GetInstance().OverrideBoolFlagValue(