@@ -7,6 +7,7 @@ use lightning::util::ser::Writer;
7
7
use chrono:: Utc ;
8
8
9
9
use std:: fs;
10
+ #[ cfg( not( target_os = "windows" ) ) ]
10
11
use std:: os:: unix:: fs:: symlink;
11
12
use std:: path:: Path ;
12
13
@@ -31,14 +32,18 @@ impl FilesystemLogger {
31
32
. open ( log_file_path. clone ( ) )
32
33
. map_err ( |e| eprintln ! ( "ERROR: Failed to open log file: {}" , e) ) ?;
33
34
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) ) ?;
39
46
}
40
- symlink ( & log_file_name, & log_file_symlink)
41
- . map_err ( |e| eprintln ! ( "ERROR: Failed to create log file symlink: {}" , e) ) ?;
42
47
}
43
48
44
49
Ok ( Self { file_path : log_file_path, level } )
0 commit comments