@@ -7,6 +7,7 @@ use lightning::util::ser::Writer;
77use chrono:: Utc ;
88
99use std:: fs;
10+ #[ cfg( not( target_os = "windows" ) ) ]
1011use std:: os:: unix:: fs:: symlink;
1112use std:: path:: Path ;
1213
@@ -31,14 +32,18 @@ impl FilesystemLogger {
3132 . open ( log_file_path. clone ( ) )
3233 . map_err ( |e| eprintln ! ( "ERROR: Failed to open log file: {}" , e) ) ?;
3334
34- // Create a symlink to the current log file, with prior cleanup
35- let log_file_symlink = parent_dir. join ( "ldk_node_latest.log" ) ;
36- if log_file_symlink. as_path ( ) . is_symlink ( ) {
37- fs:: remove_file ( & log_file_symlink)
38- . map_err ( |e| eprintln ! ( "ERROR: Failed to remove log file symlink: {}" , e) ) ?;
35+ #[ cfg( not( target_os = "windows" ) ) ]
36+ {
37+ // Create a symlink to the current log file, with prior cleanup
38+ let log_file_symlink = parent_dir. join ( "ldk_node_latest.log" ) ;
39+ if log_file_symlink. as_path ( ) . is_symlink ( ) {
40+ fs:: remove_file ( & log_file_symlink) . map_err ( |e| {
41+ eprintln ! ( "ERROR: Failed to remove log file symlink: {}" , e)
42+ } ) ?;
43+ }
44+ symlink ( & log_file_name, & log_file_symlink)
45+ . map_err ( |e| eprintln ! ( "ERROR: Failed to create log file symlink: {}" , e) ) ?;
3946 }
40- symlink ( & log_file_name, & log_file_symlink)
41- . map_err ( |e| eprintln ! ( "ERROR: Failed to create log file symlink: {}" , e) ) ?;
4247 }
4348
4449 Ok ( Self { file_path : log_file_path, level } )
0 commit comments