Logging for prekey fetches, load of log files (#1836)

* Log the files discovered in logPath

I've encountered some logs which include very old entries; and my
suspicion is that we're not cleaning up old log files properly.

* Log prekey fetches (success and failure), just like signed keys

* Force log file information into the final web-ready log
This commit is contained in:
Scott Nonnenberg 2017-11-30 11:56:46 -08:00 committed by GitHub
parent 44da6924f9
commit d9a48478ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 3 deletions

View file

@ -93,8 +93,19 @@ function fetch(logPath) {
return path.join(logPath, file)
});
// creating a manual log entry for the final log result
var now = new Date();
const fileListEntry = {
level: 30, // INFO
time: now.toJSON(),
msg: 'Loaded this list of log files from logPath: ' + files.join(', '),
};
return Promise.all(paths.map(fetchLog)).then(function(results) {
const data = _.flatten(results);
data.push(fileListEntry);
return _.sortBy(data, 'time');
});
}

View file

@ -186,11 +186,15 @@
var prekey = new PreKey({id: keyId});
return new Promise(function(resolve) {
prekey.fetch().then(function() {
console.log('Successfully fetched prekey:', keyId);
resolve({
pubKey: prekey.attributes.publicKey,
privKey: prekey.attributes.privateKey
pubKey: prekey.get('publicKey'),
privKey: prekey.get('privateKey'),
});
}).fail(resolve);
}, function() {
console.log('Failed to load prekey:', keyId);
resolve();
});
});
},
storePreKey: function(keyId, keyPair) {