diff --git a/.gitignore b/.gitignore index 3e9f730..8d34b29 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ ### Node ### # Logs logs/*.json +logs *.log npm-debug.log* yarn-debug.log* @@ -192,4 +193,5 @@ config-*.json sourceDataset targetDataset *-linux -*-macos \ No newline at end of file +*-macos +*-win.exe \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index b7e98a3..00b6224 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file. This projec ## 1.1.0 - Released the 2024/01/05 - Fixed Synchro with S3 Scaleway: The etag from ListObjectV2 was returning encoded double quotes """ instead of "\"". +- Fixed "logSync" option: if enabled, the `logs` folder is created automatically if it does not exist. - Updated dev npm packages ## 1.0.0 diff --git a/logic.js b/logic.js index 38af9b5..1014f6e 100644 --- a/logic.js +++ b/logic.js @@ -117,8 +117,11 @@ function computeSync(files, mode, deletion, logSync) { function syncLogGenerate(data) { try { + if (fs.existsSync(path.join("logs")) === false) { + fs.mkdirSync(path.join("logs")); + } const date = new Date().toISOString().split('.')[0].replace('T', '-').replace(/:/g, '-') + "Z"; - fs.writeFileSync(path.join(__dirname, "logs", 'sync-' + date + '.json'), JSON.stringify(data)) + fs.writeFileSync(path.join("logs", 'sync-' + date + '.json'), JSON.stringify(data)) } catch(err) { console.log("Log sync error catched:" + err.toString()); }