1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-26 22:41:17 +02:00

Tools: Added syncDebugLog to help debugging sync operations

This commit is contained in:
Laurent Cozic
2021-10-15 12:24:22 +01:00
parent 0ccd8dee41
commit fb935dde18
8 changed files with 47 additions and 6 deletions

View File

@@ -25,6 +25,7 @@ import JoplinDatabase from './JoplinDatabase';
import { fetchSyncInfo, getActiveMasterKey, localSyncInfo, mergeSyncInfos, saveLocalSyncInfo, SyncInfo, syncInfoEquals, uploadSyncInfo } from './services/synchronizer/syncInfoUtils';
import { getMasterPassword, setupAndDisableEncryption, setupAndEnableEncryption } from './services/e2ee/utils';
import { generateKeyPair } from './services/e2ee/ppk';
import syncDebugLog from './services/synchronizer/syncDebugLog';
const { sprintf } = require('sprintf-js');
const { Dirnames } = require('./services/synchronizer/utils/types');
@@ -197,7 +198,7 @@ export default class Synchronizer {
return lines;
}
logSyncOperation(action: any, local: any = null, remote: RemoteItem = null, message: string = null, actionCount: number = 1) {
logSyncOperation(action: string, local: any = null, remote: RemoteItem = null, message: string = null, actionCount: number = 1) {
const line = ['Sync'];
line.push(action);
if (message) line.push(message);
@@ -225,6 +226,8 @@ export default class Synchronizer {
logger.debug(line.join(': '));
}
if (!['fetchingProcessed', 'fetchingTotal'].includes(action)) syncDebugLog.info(line.join(': '));
if (!this.progressReport_[action]) this.progressReport_[action] = 0;
this.progressReport_[action] += actionCount;
this.progressReport_.state = this.state();