File tree Expand file tree Collapse file tree 3 files changed +8
-4
lines changed
topics/p2p-transfer-protocol Expand file tree Collapse file tree 3 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -40,8 +40,10 @@ enum Commands {
4040}
4141
4242fn main ( ) {
43- // Initialize logger
44- env_logger:: init ( ) ;
43+ // Initialize logger to INFO level by default
44+ env_logger:: init_from_env (
45+ env_logger:: Env :: default ( ) . filter_or ( env_logger:: DEFAULT_FILTER_ENV , "info" ) ,
46+ ) ;
4547
4648 let cli = Cli :: parse ( ) ;
4749 // Note: if no command matches, clap automatically provides the help message & exits.
@@ -81,7 +83,7 @@ fn server_mode(bind_addr: &str, file_path: &str) -> io::Result<()> {
8183 . create ( true )
8284 . open ( file_path) ?;
8385
84- println ! (
86+ info ! (
8587 "Server listening on {:?}. Saving to {}" ,
8688 listener, file_path
8789 ) ;
Original file line number Diff line number Diff line change @@ -2,14 +2,16 @@ use std::fs::File;
22use std:: io;
33use std:: net:: TcpStream ;
44
5+ use log:: info;
6+
57use crate :: server:: connection:: handle_connection;
68
79mod connection;
810mod events;
911
1012pub fn run_server ( file : & mut File , stream : & mut TcpStream ) -> Result < ( ) , io:: Error > {
1113 let peer_addr = stream. peer_addr ( ) ?;
12- println ! ( "New connection from {peer_addr}" ) ;
14+ info ! ( "New connection from {peer_addr}" ) ;
1315
1416 handle_connection ( file, stream)
1517}
You can’t perform that action at this time.
0 commit comments