mirror of
https://github.com/smoltcp-rs/smoltcp.git
synced 2025-09-29 22:02:05 +00:00
Make the log crate properly optional.
This commit is contained in:
parent
44db954f8e
commit
d5f11159d8
@ -11,5 +11,6 @@ travis_config['matrix']['include'].each do |env|
|
||||
travis_config['script'].each do |cmd|
|
||||
$stderr.puts('+ ' + cmd.gsub(/\$(\w+)/) { ENV[$1] })
|
||||
system(cmd)
|
||||
$?.success? or exit 1
|
||||
end
|
||||
end
|
||||
|
@ -1,4 +1,5 @@
|
||||
#[cfg(feature = "log")]
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
#[cfg(feature = "log")]
|
||||
extern crate env_logger;
|
||||
|
@ -83,8 +83,7 @@ extern crate std;
|
||||
extern crate libc;
|
||||
#[cfg(feature = "alloc")]
|
||||
extern crate alloc;
|
||||
#[cfg(any(test, feature = "log"))]
|
||||
#[allow(unused_imports)]
|
||||
#[cfg(feature = "log")]
|
||||
#[macro_use(log, trace, debug)]
|
||||
extern crate log;
|
||||
|
||||
|
@ -1555,12 +1555,12 @@ mod test {
|
||||
payload_len: repr.buffer_len(),
|
||||
hop_limit: 64
|
||||
};
|
||||
trace!("send: {}", repr);
|
||||
net_trace!("send: {}", repr);
|
||||
|
||||
assert!(socket.accepts(&ip_repr, repr));
|
||||
match socket.process(timestamp, &ip_repr, repr) {
|
||||
Ok(Some((_ip_repr, repr))) => {
|
||||
trace!("recv: {}", repr);
|
||||
net_trace!("recv: {}", repr);
|
||||
Ok(Some(repr))
|
||||
}
|
||||
Ok(None) => Ok(None),
|
||||
@ -1580,7 +1580,7 @@ mod test {
|
||||
assert_eq!(ip_repr.dst_addr(), REMOTE_IP);
|
||||
assert_eq!(ip_repr.payload_len(), tcp_repr.buffer_len());
|
||||
|
||||
trace!("recv: {}", tcp_repr);
|
||||
net_trace!("recv: {}", tcp_repr);
|
||||
Ok(f(Ok(tcp_repr)))
|
||||
});
|
||||
match result {
|
||||
@ -1637,6 +1637,7 @@ mod test {
|
||||
})
|
||||
}
|
||||
|
||||
#[cfg(feature = "log")]
|
||||
fn init_logger() {
|
||||
extern crate log;
|
||||
use std::boxed::Box;
|
||||
@ -1662,6 +1663,7 @@ mod test {
|
||||
}
|
||||
|
||||
fn socket() -> TcpSocket<'static> {
|
||||
#[cfg(feature = "log")]
|
||||
init_logger();
|
||||
|
||||
let rx_buffer = SocketBuffer::new(vec![0; 64]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user