Skip to content

Commit

Permalink
Fix logs directory
Browse files Browse the repository at this point in the history
  • Loading branch information
steevepay committed Jan 5, 2024
1 parent a6b567c commit d6fb19e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
### Node ###
# Logs
logs/*.json
logs
*.log
npm-debug.log*
yarn-debug.log*
Expand Down Expand Up @@ -192,4 +193,5 @@ config-*.json
sourceDataset
targetDataset
*-linux
*-macos
*-macos
*-win.exe
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion logic.js
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down

0 comments on commit d6fb19e

Please sign in to comment.