better logs

This commit is contained in:
Girish Ramakrishnan
2021-03-03 13:49:22 -08:00
parent 3a19ab6866
commit 149e176cfd

View File

@@ -35,7 +35,7 @@ function checkAppUpdates(options, callback) {
assert.strictEqual(typeof options, 'object');
assert.strictEqual(typeof callback, 'function');
debug('Checking App Updates');
debug('checkAppUpdates: checking for updates');
let state = getUpdateInfo();
let newState = { }; // create new state so that old app ids are removed
@@ -50,7 +50,7 @@ function checkAppUpdates(options, callback) {
appstore.getAppUpdate(app, options, function (error, updateInfo) {
if (error) {
debug('Error getting app update info for %s', app.id, error);
debug('checkAppUpdates: Error getting app update info for %s', app.id, error);
return iteratorDone(); // continue to next
}
@@ -59,10 +59,12 @@ function checkAppUpdates(options, callback) {
newState[app.id] = updateInfo;
if (safe.query(state[app.id], 'manifest.version') === updateInfo.manifest.version) {
debug(`Skipping app update notification of ${app.id} since user was already notified of ${updateInfo.manifest.version}`);
debug(`checkAppUpdates: Skipping app update notification of ${app.id} since user was already notified of ${updateInfo.manifest.version}`);
return iteratorDone();
}
debug(`checkAppUpdates: ${app.id} can be updated to ${updateInfo.manifest.id}@${updateInfo.manifest.version}`);
pendingNotifications.push({ app, updateInfo });
iteratorDone();
});
@@ -80,7 +82,7 @@ function checkBoxUpdates(options, callback) {
assert.strictEqual(typeof options, 'object');
assert.strictEqual(typeof callback, 'function');
debug('Checking Box Updates');
debug('checkBoxUpdates: checking for updates');
appstore.getBoxUpdate(options, function (error, updateInfo) {
if (error) return callback(error);
@@ -92,14 +94,17 @@ function checkBoxUpdates(options, callback) {
delete state.box;
setUpdateInfo(state);
}
debug('checkBoxUpdates: no updates');
return callback(null);
}
if (state.box && state.box.version === updateInfo.version) {
debug('Skipping notification of box update as user was already notified');
debug(`checkBoxUpdates: Skipping notification of box update ${updateInfo.version} as user was already notified`);
return callback();
}
debug(`checkBoxUpdates: ${updateInfo.version} is available`);
const changelog = updateInfo.changelog.map((m) => `* ${m}\n`).join('');
const message = `Changelog:\n${changelog}\n\nGo to the settings view to update.\n\n`;