fn debug(&mut self, kind: InfoType, data: &[u8]) {
        fn format_byte_string(bytes: impl AsRef<[u8]>) -> String {
            String::from_utf8(
                bytes
                    .as_ref()
                    .iter()
                    .flat_map(|byte| ascii::escape_default(*byte))
                    .collect(),
            )
            .unwrap_or_else(|_| String::from("<binary>"))
        }

        match kind {
            InfoType::Text => log::debug!(target: "isahc::curl", "{}", String::from_utf8_lossy(data).trim_end()),
            InfoType::HeaderIn | InfoType::DataIn => log::trace!(target: "isahc::wire", "<< {}", format_byte_string(data)),
            InfoType::HeaderOut | InfoType::DataOut => log::trace!(target: "isahc::wire", ">> {}", format_byte_string(data)),
            _ => (),
        }
    }
/// Gets called by curl whenever it wishes to log a debug message.
///
/// Since we're using the log crate, this callback normalizes the debug info
/// and writes it to our log.
Gets called by curl whenever it wishes to log a debug message.
Since we're using the log crate, this callback normalizes the debug info
and writes it to our log.
Gets called by curl whenever it wishes to log a debug message . Since we ' re using the log crate this callback normalizes the debug info and writes it to our log .
fn debug(&mut self, kind: InfoType, data: &[u8]) {
        fn format_byte_string(bytes: impl AsRef<[u8]>) -> String {
            String::from_utf8(
                bytes
                    .as_ref()
                    .iter()
                    .flat_map(|byte| ascii::escape_default(*byte))
                    .collect(),
            )
            .unwrap_or_else(|_| String::from("<binary>"))
        }
        match kind {
            InfoType::Text => log::debug!(target: "isahc::curl", "{}", String::from_utf8_lossy(data).trim_end()),
            InfoType::HeaderIn | InfoType::DataIn => log::trace!(target: "isahc::wire", "<< {}", format_byte_string(data)),
            InfoType::HeaderOut | InfoType::DataOut => log::trace!(target: "isahc::wire", ">> {}", format_byte_string(data)),
            _ => (),
        }
    }
fn debug ( & mut self , kind : InfoType , data : & [ u8 ] ) { fn format_byte_string ( bytes : impl AsRef < [ u8 ] > ) -> String { String :: from_utf8 ( bytes . as_ref ( ) . iter ( ) . flat_map ( | byte | ascii :: escape_default ( * byte ) ) . collect ( ) , ) . unwrap_or_else ( | _ | String :: from ( " " ) ) } match kind { InfoType :: Text => log :: debug ! ( target " " " " String from_utf8_lossy ( data ) trim_end ( ) ) , InfoType :: HeaderIn | InfoType :: DataIn => log :: trace ! ( target " " " " format_byte_string ( data ) ) , InfoType :: HeaderOut | InfoType :: DataOut => log :: trace ! ( target " " " " format_byte_string ( data ) ) , _ => ( ) , } }
Gets called by curl whenever it wishes to log a debug message.
Gets called by curl whenever it wishes to log a debug message .
&mut self
kind
InfoType
data
&[u8]