Skip to content

Commit e13fb20

Browse files
committed
Add the date when the node was started to the name of the logfile. This makes it easier to delete old logs
1 parent 427e74c commit e13fb20

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/lib.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,8 +383,14 @@ impl Builder {
383383
let bdk_data_dir = format!("{}/bdk", config.storage_dir_path);
384384
fs::create_dir_all(bdk_data_dir.clone()).expect("Failed to create BDK data directory");
385385

386+
let logs_dir = format!("{}/logs", config.storage_dir_path);
387+
386388
// Initialize the Logger
387-
let log_file_path = format!("{}/ldk_node.log", config.storage_dir_path);
389+
let log_file_path = format!(
390+
"{}/ldk_node_{}.log",
391+
logs_dir,
392+
chrono::offset::Local::now().format("%Y_%m_%d")
393+
);
388394
let logger = Arc::new(FilesystemLogger::new(log_file_path, config.log_level));
389395

390396
// Initialize the on-chain wallet and chain access

0 commit comments

Comments
 (0)