/// Internal method that put a listener on `logger_socket`, process and send logs asynchronously
/// in the background.
Internal method that put a listener on `logger_socket`, process and send logs asynchronously
in the background.
Internal method that put a listener on ` logger_socket ` process and send logs asynchronously in the background .
fn collect_and_send_logs(
        name: String,
        logger_socket: fidl::Socket,
        mut sender: mpsc::Sender<TestEvent>,
    ) -> Option<BoxFuture<'static, Result<(), anyhow::Error>>> {
        if logger_socket.as_handle_ref().is_invalid() {
            return None;
        }
        let mut ls = match LoggerStream::new(logger_socket) {
            Err(e) => {
                log::error!("Logger: Failed to create fuchsia async socket: {:?}", e);
                return None;
            }
            Ok(ls) => ls,
        };
        let f = async move {
            while let Some(log) = ls
                .try_next()
                .await
                .map_err(|e| format_err!("Error while reading log msg: {}", e))?
            {
                sender
                    .send(TestEvent::log_message(&name, &log))
                    .map_err(|e| format_err!("Error while sending log msg: {}", e))
                    .await?
            }
            Ok(())
        };
        let (remote, remote_handle) = f.remote_handle();
        hoist::spawn(remote);
        Some(remote_handle.boxed())
    }
fn collect_and_send_logs ( name : String , logger_socket : fidl :: Socket , mut sender : mpsc :: Sender < TestEvent > , ) -> Option < BoxFuture < ' static , Result < ( ) , anyhow :: Error > > > { if logger_socket . as_handle_ref ( ) . is_invalid ( ) { return None ; } let mut ls = match LoggerStream :: new ( logger_socket ) { Err ( e ) => { log :: error ! ( " " e ) ; return None ; } Ok ( ls ) => ls , } ; let f = async move { while let Some ( log ) = ls . try_next ( ) . await . map_err ( | e | format_err ! ( " " e ) ) ? { sender . send ( TestEvent :: log_message ( & name , & log ) ) . map_err ( | e | format_err ! ( " " e ) ) . await ? } Ok ( ( ) ) } ; let ( remote , remote_handle ) = f . remote_handle ( ) ; hoist :: spawn ( remote ) ; Some ( remote_handle . boxed ( ) ) }
Internal method that put a listener on `logger_socket`, process and send logs asynchronously
in the background.
Internal method that put a listener on ` logger_socket ` process and send logs asynchronously in the background .
name
String
logger_socket
fidl::Socket
sender
mpsc::Sender<TestEvent>