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:
parent
44da6924f9
commit
d9a48478ec
2 changed files with 18 additions and 3 deletions
|
@ -93,8 +93,19 @@ function fetch(logPath) {
|
||||||
return path.join(logPath, file)
|
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) {
|
return Promise.all(paths.map(fetchLog)).then(function(results) {
|
||||||
const data = _.flatten(results);
|
const data = _.flatten(results);
|
||||||
|
|
||||||
|
data.push(fileListEntry);
|
||||||
|
|
||||||
return _.sortBy(data, 'time');
|
return _.sortBy(data, 'time');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -186,11 +186,15 @@
|
||||||
var prekey = new PreKey({id: keyId});
|
var prekey = new PreKey({id: keyId});
|
||||||
return new Promise(function(resolve) {
|
return new Promise(function(resolve) {
|
||||||
prekey.fetch().then(function() {
|
prekey.fetch().then(function() {
|
||||||
|
console.log('Successfully fetched prekey:', keyId);
|
||||||
resolve({
|
resolve({
|
||||||
pubKey: prekey.attributes.publicKey,
|
pubKey: prekey.get('publicKey'),
|
||||||
privKey: prekey.attributes.privateKey
|
privKey: prekey.get('privateKey'),
|
||||||
});
|
});
|
||||||
}).fail(resolve);
|
}, function() {
|
||||||
|
console.log('Failed to load prekey:', keyId);
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
storePreKey: function(keyId, keyPair) {
|
storePreKey: function(keyId, keyPair) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue