1// Copyright 2020 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
45use anyhow::Error;
6use fidl_fuchsia_boot as fboot;
7use zx::{self as zx, HandleBased};
89pub async fn init() -> Result<(), Error> {
10let write_only_log_proxy =
11 fuchsia_component::client::connect_to_protocol::<fboot::WriteOnlyLogMarker>()?;
1213let debuglog_handle = write_only_log_proxy.get().await?;
1415for fd in &[1, 2] {
16let debuglog_dup = debuglog_handle.duplicate_handle(zx::Rights::SAME_RIGHTS)?;
17 fdio::bind_to_fd(debuglog_dup.into_handle(), *fd)?;
18 }
19Ok(())
20}