Remove/fix a bunch of logging

This commit is contained in:
jliddev
2020-10-25 00:20:47 -05:00
parent 25b20e6810
commit cea3ca916b
13 changed files with 62 additions and 65 deletions

View File

@@ -58,7 +58,6 @@ log.transports.file.resolvePath = (
variables: log.PathVariables,
_message?: log.LogMessage
) => {
console.log("RES", path.join(LOG_PATH, variables.fileName));
return path.join(LOG_PATH, variables.fileName);
};
log.info("Main starting");
@@ -86,7 +85,6 @@ const args = process.argv.slice(1),
serve = args.some((val) => val === "--serve");
function createTray() {
console.log("TRAY");
const trayIconPath = path.join(__dirname, "assets", "wowup_logo_512np.png");
const icon = nativeImage.createFromPath(trayIconPath).resize({ width: 16 });
@@ -108,7 +106,6 @@ function createTray() {
if (isWin) {
tray.on("click", () => {
console.log("SHOW");
win.show();
});
}

View File

@@ -76,11 +76,11 @@ export class CurseAddonProvider implements AddonProvider {
const scanResults = await this.getScanResults(addonFolders);
console.log("ScanResults", scanResults.length);
console.debug("ScanResults", scanResults.length);
await this.mapAddonFolders(scanResults, clientType);
console.log("mapAddonFolders");
console.debug("mapAddonFolders");
const matchedScanResults = scanResults.filter((sr) => !!sr.exactMatch);
const matchedScanResultIds = matchedScanResults.map(
@@ -119,8 +119,6 @@ export class CurseAddonProvider implements AddonProvider {
public getScanResults = async (
addonFolders: AddonFolder[]
): Promise<AppCurseScanResult[]> => {
const t1 = Date.now();
const filePaths = addonFolders.map((addonFolder) => addonFolder.path);
const scanResults: CurseScanResult[] = await this._electronService.ipcRenderer.invoke(
CURSE_GET_SCAN_RESULTS,
@@ -137,7 +135,6 @@ export class CurseAddonProvider implements AddonProvider {
}
);
console.log("scan delta", Date.now() - t1);
return appScanResults;
};
@@ -157,8 +154,6 @@ export class CurseAddonProvider implements AddonProvider {
scanResults.map((result) => result.fingerprint)
);
console.log("fingerprintResponse", fingerprintResponse);
for (let scanResult of scanResults) {
// Curse can deliver the wrong result sometimes, ensure the result matches the client type
scanResult.exactMatch = fingerprintResponse.exactMatches.find(
@@ -355,9 +350,6 @@ export class CurseAddonProvider implements AddonProvider {
const searchWord = _.first(slug.split("-"));
const response = await this.getSearchResults(searchWord);
console.log("slug", slug);
console.log("searchWord", searchWord);
const match = _.find(response, (res) => res.slug === slug);
if (!match) {
throw new Error(NO_SEARCH_RESULTS_ERROR);

View File

@@ -235,7 +235,6 @@ export class TukUiAddonProvider implements AddonProvider {
try {
const addons = await this._circuitBreaker.fire(clientType);
console.log("CACHED");
this._cachingService.set(cacheKey, addons, CACHE_TIME);
return addons;
} catch (err) {

View File

@@ -102,7 +102,7 @@ export class WowUpAddonProvider implements AddonProvider {
const scanResults = await this.getScanResults(addonFolders);
console.log("ScanResults", scanResults.length);
console.debug("ScanResults", scanResults.length);
const fingerprintResponse = await this.getAddonsByFingerprints(
scanResults.map((result) => result.fingerprint)

View File

@@ -71,7 +71,7 @@ export class AppComponent implements AfterViewInit {
}
private onAutoUpdateInterval = async () => {
console.log("Auto update");
console.debug("Auto update");
const updateCount = await this._addonService.processAutoUpdates();
if (updateCount === 0) {

View File

@@ -33,8 +33,6 @@ export class AddonDetailComponent implements OnInit, OnDestroy {
private _translateService: TranslateService,
private _cdRef: ChangeDetectorRef
) {
console.log(this.model);
this._subscriptions.push(
this._addonService.addonInstalled$
.pipe(

View File

@@ -80,7 +80,6 @@ export class AddonInstallButtonComponent implements OnInit, OnDestroy {
}
public getInstallStateText(installState: AddonInstallState) {
console.log("getInstallStateText", installState);
switch (installState) {
case AddonInstallState.BackingUp:
return this._translate.instant("COMMON.ADDON_STATUS.BACKINGUP");

View File

@@ -87,7 +87,7 @@ export class InstallFromUrlDialogComponent implements OnInit, OnDestroy {
this._sessionService.selectedClientType
);
console.log(importedAddon);
console.debug(importedAddon);
if (!importedAddon) {
throw new Error("Addon not found");
}
@@ -107,7 +107,8 @@ export class InstallFromUrlDialogComponent implements OnInit, OnDestroy {
let message = err.message;
if (err instanceof HttpErrorResponse) {
message = `No addon was found.`;
} else if (err.code && err.code === "EOPENBREAKER") { // Provider circuit breaker is open
} else if (err.code && err.code === "EOPENBREAKER") {
// Provider circuit breaker is open
message = `Cannot connect to API, please wait a bit and try again.`;
}

View File

@@ -27,7 +27,6 @@ export class TitlebarComponent implements OnInit, OnDestroy {
) {
const windowMaximizedSubscription = this.electronService.windowMaximized$.subscribe(
(maximized) => {
console.log('subscription maximized:', maximized);
this._ngZone.run(() => (this.isMaximized = maximized));
}
);

View File

@@ -218,14 +218,13 @@ export class MyAddonsComponent implements OnInit, OnDestroy {
}
public onRefresh() {
this.spinnerMessage = this._translateService.instant("PAGES.MY_ADDONS.SPINNER.LOADING");
this.spinnerMessage = this._translateService.instant(
"PAGES.MY_ADDONS.SPINNER.LOADING"
);
this.loadAddons(this.selectedClient);
}
public onRowClicked(event: MouseEvent, row: AddonViewModel, index: number) {
console.log(row.displayState);
console.log("index clicked: " + index);
if (
(event.ctrlKey && !this.electronService.isMac) ||
(event.metaKey && this.electronService.isMac)
@@ -398,8 +397,6 @@ export class MyAddonsComponent implements OnInit, OnDestroy {
}
public onColumnVisibleChange(event: MatCheckboxChange, column: ColumnState) {
console.log(event, column);
const col = this.columns.find((col) => col.name === column.name);
col.visible = event.checked;
}
@@ -407,8 +404,12 @@ export class MyAddonsComponent implements OnInit, OnDestroy {
public onReScan() {
const dialogRef = this._dialog.open(ConfirmDialogComponent, {
data: {
title: this._translateService.instant("PAGES.MY_ADDONS.RESCAN_FOLDERS_CONFIRMATION_TITLE"),
message: this._translateService.instant("PAGES.MY_ADDONS.RESCAN_FOLDERS_CONFIRMATION_DESCRIPTION"),
title: this._translateService.instant(
"PAGES.MY_ADDONS.RESCAN_FOLDERS_CONFIRMATION_TITLE"
),
message: this._translateService.instant(
"PAGES.MY_ADDONS.RESCAN_FOLDERS_CONFIRMATION_DESCRIPTION"
),
},
});
@@ -429,14 +430,17 @@ export class MyAddonsComponent implements OnInit, OnDestroy {
data: {
title: this._translateService.instant(
"PAGES.MY_ADDONS.UNINSTALL_POPUP.TITLE",
{count: 1}
),
message: this._translateService.instant(
"PAGES.MY_ADDONS.UNINSTALL_POPUP.CONFIRMATION_ONE",
{addonName: addon.name}
) + "\n" + this._translateService.instant(
"PAGES.MY_ADDONS.UNINSTALL_POPUP.CONFIRMATION_ACTION_EXPLANATION"
{ count: 1 }
),
message:
this._translateService.instant(
"PAGES.MY_ADDONS.UNINSTALL_POPUP.CONFIRMATION_ONE",
{ addonName: addon.name }
) +
"\n" +
this._translateService.instant(
"PAGES.MY_ADDONS.UNINSTALL_POPUP.CONFIRMATION_ACTION_EXPLANATION"
),
},
});
@@ -455,26 +459,28 @@ export class MyAddonsComponent implements OnInit, OnDestroy {
if (listItems.length > 3) {
message = this._translateService.instant(
"PAGES.MY_ADDONS.UNINSTALL_POPUP.CONFIRMATION_MORE_THAN_THREE",
{count: listItems.length}
{ count: listItems.length }
);
} else {
message = this._translateService.instant(
"PAGES.MY_ADDONS.UNINSTALL_POPUP.CONFIRMATION_LESS_THAN_THREE",
{count: listItems.length}
{ count: listItems.length }
);
listItems.forEach(
(listItem) => (message = `${message}\n\t• ${listItem.addon.name}`)
);
}
message += "\n" + this._translateService.instant(
"PAGES.MY_ADDONS.UNINSTALL_POPUP.CONFIRMATION_ACTION_EXPLANATION"
);
message +=
"\n" +
this._translateService.instant(
"PAGES.MY_ADDONS.UNINSTALL_POPUP.CONFIRMATION_ACTION_EXPLANATION"
);
const dialogRef = this._dialog.open(ConfirmDialogComponent, {
data: {
title: this._translateService.instant(
"PAGES.MY_ADDONS.UNINSTALL_POPUP.TITLE",
{count: listItems.length}
{ count: listItems.length }
),
message: message,
},
@@ -568,7 +574,9 @@ export class MyAddonsComponent implements OnInit, OnDestroy {
private async updateAllWithSpinner(...clientTypes: WowClientType[]) {
this.isBusy = true;
this.spinnerMessage = this._translateService.instant("PAGES.MY_ADDONS.SPINNER.GATHERING_ADDONS")
this.spinnerMessage = this._translateService.instant(
"PAGES.MY_ADDONS.SPINNER.GATHERING_ADDONS"
);
try {
let updatedCt = 0;
@@ -588,20 +596,26 @@ export class MyAddonsComponent implements OnInit, OnDestroy {
return;
}
this.spinnerMessage = this._translateService.instant("PAGES.MY_ADDONS.SPINNER.UPDATING", {
updateCount : updatedCt,
addonCount : addons.length,
});
this.spinnerMessage = this._translateService.instant(
"PAGES.MY_ADDONS.SPINNER.UPDATING",
{
updateCount: updatedCt,
addonCount: addons.length,
}
);
for (let addon of addons) {
updatedCt += 1;
this.spinnerMessage = this._translateService.instant("PAGES.MY_ADDONS.SPINNER.UPDATING_WITH_ADDON_NAME", {
updateCount : updatedCt,
addonCount : addons.length,
clientType : getEnumName(WowClientType, addon.clientType),
addonName : addon.name,
});
this.spinnerMessage = this._translateService.instant(
"PAGES.MY_ADDONS.SPINNER.UPDATING_WITH_ADDON_NAME",
{
updateCount: updatedCt,
addonCount: addons.length,
clientType: getEnumName(WowClientType, addon.clientType),
addonName: addon.name,
}
);
await this.addonService.installAddon(addon.id);
}
@@ -689,8 +703,8 @@ export class MyAddonsComponent implements OnInit, OnDestroy {
this.tabIndex,
this._translateService.instant(
"PAGES.MY_ADDONS.PAGE_CONTEXT_FOOTER.ADDONS_INSTALLED",
{count: this._displayAddonsSrc.value.length
})
{ count: this._displayAddonsSrc.value.length }
)
);
}
@@ -701,7 +715,9 @@ export class MyAddonsComponent implements OnInit, OnDestroy {
case AddonInstallState.Complete:
return this._translateService.instant("COMMON.ADDON_STATE.UPTODATE");
case AddonInstallState.Downloading:
return this._translateService.instant("COMMON.ADDON_STATUS.DOWNLOADING");
return this._translateService.instant(
"COMMON.ADDON_STATUS.DOWNLOADING"
);
case AddonInstallState.Installing:
return this._translateService.instant("COMMON.ADDON_STATUS.INSTALLING");
case AddonInstallState.Pending:

View File

@@ -67,7 +67,7 @@ export class AddonService {
this._installQueue
.pipe(mergeMap((item) => from(this.processInstallQueue(item)), 3))
.subscribe((addonName) => {
console.log("INSTALL DONE", addonName);
console.log("Install complete", addonName);
});
}
@@ -216,8 +216,6 @@ export class AddonService {
const downloadFileName = `${slug(addon.name)}.zip`;
console.log("installAddon", addon.name);
onUpdate?.call(this, AddonInstallState.Downloading, 25);
this._addonInstalledSrc.next({
addon,
@@ -482,7 +480,7 @@ export class AddonService {
let addons = this._addonStorage.getAllForClientType(clientType);
if (rescan || addons.length === 0) {
const newAddons = await this.scanAddons(clientType);
console.log(newAddons);
console.debug('newAddons', newAddons);
this._addonStorage.removeAllForClientType(clientType);
addons = this.updateAddons(addons, newAddons);
@@ -610,7 +608,7 @@ export class AddonService {
validFolders
);
} catch (err) {
console.log(err);
console.error(err);
}
}

View File

@@ -34,8 +34,6 @@ export class AnalyticsService {
return;
}
console.log("Firebase setup");
this._firebaseApp = firebase.initializeApp(AppConfig.firebaseConfig);
this._firebaseAnalytics = firebase.analytics(this._firebaseApp);
this._firebaseAnalytics.setUserId(this.installId);

View File

@@ -79,7 +79,7 @@ export class ElectronService {
.then(() =>
console.log("Zoom levels have been set between 100% and 300%")
)
.catch((err) => console.log(err));
.catch((err) => console.error(err));
currentWindow.webContents.on("zoom-changed", (event, zoomDirection) => {
let currentZoom = currentWindow.webContents.getZoomFactor();