@@ -298,9 +298,9 @@ impl NodeBuilder {
298298 self
299299 }
300300
301- /// Sets the log dir path if logs need to live separate from the storage directory path.
302- pub fn set_log_dir_path ( & mut self , log_dir_path : String ) -> & mut Self {
303- self . config . log_dir_path = Some ( log_dir_path) ;
301+ /// Sets the log file path if the log file needs to live separate from the storage directory path.
302+ pub fn set_log_file_path ( & mut self , log_dir_path : String ) -> & mut Self {
303+ self . config . log_file_path = Some ( log_dir_path) ;
304304 self
305305 }
306306
@@ -610,9 +610,9 @@ impl ArcedNodeBuilder {
610610 self . inner . write ( ) . unwrap ( ) . set_storage_dir_path ( storage_dir_path) ;
611611 }
612612
613- /// Sets the log dir path if logs need to live separate from the storage directory path.
614- pub fn set_log_dir_path ( & self , log_dir_path : String ) {
615- self . inner . write ( ) . unwrap ( ) . set_log_dir_path ( log_dir_path ) ;
613+ /// Sets the log file path if logs need to live separate from the storage directory path.
614+ pub fn set_log_file_path ( & self , log_file_path : String ) {
615+ self . inner . write ( ) . unwrap ( ) . set_log_file_path ( log_file_path ) ;
616616 }
617617
618618 /// Sets the Bitcoin network used.
@@ -1231,14 +1231,16 @@ fn build_with_store_internal(
12311231 } )
12321232}
12331233
1234+ /// Sets up the node logger, creating a new log file if it does not exist, or utilizing
1235+ /// the existing log file.
12341236fn setup_logger ( config : & Config ) -> Result < Arc < FilesystemLogger > , BuildError > {
1235- let log_dir = match & config. log_dir_path {
1237+ let log_file_path = match & config. log_file_path {
12361238 Some ( log_dir) => String :: from ( log_dir) ,
1237- None => config. storage_dir_path . clone ( ) + "/logs" ,
1239+ None => format ! ( "{}/{}" , config. storage_dir_path. clone( ) , "ldk_node.log" ) ,
12381240 } ;
12391241
12401242 Ok ( Arc :: new (
1241- FilesystemLogger :: new ( log_dir , config. log_level )
1243+ FilesystemLogger :: new ( log_file_path , config. log_level )
12421244 . map_err ( |_| BuildError :: LoggerSetupFailed ) ?,
12431245 ) )
12441246}
0 commit comments