summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorOskar Nyberg <oskar@mullvad.net>2021-12-09 11:35:57 +0100
committerOskar Nyberg <oskar@mullvad.net>2021-12-09 11:35:57 +0100
commit9ac3d19874dd7d4cd9396b142e925b0b609b8181 (patch)
treedf2a94fb8444a1355a00b0f867f9c80517e8b7f1
parent44a8a6efd56abe5f2eec791e4230014b2870508e (diff)
parent327f13f19be9e0bfab7af1490aacb5a33951901d (diff)
downloadmullvadvpn-9ac3d19874dd7d4cd9396b142e925b0b609b8181.tar.xz
mullvadvpn-9ac3d19874dd7d4cd9396b142e925b0b609b8181.zip
Merge branch 'disable-translation-error-logs-in-production'
-rw-r--r--CHANGELOG.md2
-rw-r--r--gui/src/main/daemon-rpc.ts2
-rw-r--r--gui/src/main/gui-settings.ts2
-rw-r--r--gui/src/main/index.ts8
-rw-r--r--gui/src/renderer/app.tsx4
-rw-r--r--gui/src/renderer/containers/ConnectPage.tsx19
-rw-r--r--gui/src/shared/gettext.ts2
-rw-r--r--gui/src/shared/logging.ts2
8 files changed, 20 insertions, 21 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3452504498..5a410df62f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -28,6 +28,8 @@ Line wrap the file at 100 chars. Th
instead of setting them to default values.
- Obscure account number in account view and add button for copying instead of copying when text is
pressed.
+- Disable logging of translation errors in production. This will among other things prevent error
+ messages from translating the country in the disconnected state.
#### Android
- Avoid running in foreground when not connected.
diff --git a/gui/src/main/daemon-rpc.ts b/gui/src/main/daemon-rpc.ts
index 4dbae23630..c12ee53eff 100644
--- a/gui/src/main/daemon-rpc.ts
+++ b/gui/src/main/daemon-rpc.ts
@@ -590,7 +590,7 @@ export class DaemonRpc {
private connectivityChangeCallback(timeoutErr?: Error) {
const channel = this.client.getChannel();
const currentState = channel?.getConnectivityState(true);
- log.debug(`GRPC Channel connectivity state changed to ${currentState}`);
+ log.verbose(`GRPC Channel connectivity state changed to ${currentState}`);
if (channel) {
if (timeoutErr) {
this.setChannelCallback(currentState);
diff --git a/gui/src/main/gui-settings.ts b/gui/src/main/gui-settings.ts
index 940dd7215c..d5432e2321 100644
--- a/gui/src/main/gui-settings.ts
+++ b/gui/src/main/gui-settings.ts
@@ -106,7 +106,7 @@ export default class GuiSettings {
const error = e as Error & { code?: string };
// Read settings if the file exists, otherwise write the default settings to it.
if (error.code === 'ENOENT') {
- log.debug('Creating gui-settings file and writing the default settings to it');
+ log.verbose('Creating gui-settings file and writing the default settings to it');
this.store();
} else {
log.error(`Failed to read GUI settings file: ${error}`);
diff --git a/gui/src/main/index.ts b/gui/src/main/index.ts
index 2924408ee6..ede8384e67 100644
--- a/gui/src/main/index.ts
+++ b/gui/src/main/index.ts
@@ -270,7 +270,7 @@ class ApplicationMain {
this.initLogging();
- log.debug(`Chromium sandbox is ${SANDBOX_DISABLED ? 'disabled' : 'enabled'}`);
+ log.verbose(`Chromium sandbox is ${SANDBOX_DISABLED ? 'disabled' : 'enabled'}`);
if (!SANDBOX_DISABLED) {
app.enableSandbox();
}
@@ -354,8 +354,8 @@ class ApplicationMain {
backupLogFile(mainLogPath);
backupLogFile(rendererLogPath);
- log.addOutput(new FileOutput(LogLevel.debug, mainLogPath));
- this.rendererLog.addOutput(new FileOutput(LogLevel.debug, rendererLogPath));
+ log.addOutput(new FileOutput(LogLevel.verbose, mainLogPath));
+ this.rendererLog.addOutput(new FileOutput(LogLevel.verbose, rendererLogPath));
} catch (e) {
const error = e as Error;
console.error('Failed to initialize logging:', error);
@@ -1351,7 +1351,7 @@ class ApplicationMain {
);
reject(error.message);
} else {
- log.debug(`Problem report was written to ${reportPath}`);
+ log.verbose(`Problem report was written to ${reportPath}`);
resolve(id);
}
});
diff --git a/gui/src/renderer/app.tsx b/gui/src/renderer/app.tsx
index 4de7bb8ca6..8b4116d647 100644
--- a/gui/src/renderer/app.tsx
+++ b/gui/src/renderer/app.tsx
@@ -584,7 +584,7 @@ export default class AppRenderer {
const contentHeight = window.innerHeight;
if (contentHeight !== expectedContentHeight) {
- log.debug(
+ log.verbose(
resize ? 'Resize:' : 'Initial:',
`Wrong content height: ${contentHeight}, expected ${expectedContentHeight}`,
);
@@ -722,7 +722,7 @@ export default class AppRenderer {
private setTunnelState(tunnelState: TunnelState) {
const actions = this.reduxActions;
- log.debug(`Tunnel state: ${tunnelState.state}`);
+ log.verbose(`Tunnel state: ${tunnelState.state}`);
this.tunnelState = tunnelState;
// The main process doesn't notify the tunnel state while waiting for a new one (unless it times
diff --git a/gui/src/renderer/containers/ConnectPage.tsx b/gui/src/renderer/containers/ConnectPage.tsx
index c9ae60897b..9d507ede18 100644
--- a/gui/src/renderer/containers/ConnectPage.tsx
+++ b/gui/src/renderer/containers/ConnectPage.tsx
@@ -1,6 +1,6 @@
import { connect } from 'react-redux';
import { sprintf } from 'sprintf-js';
-import { messages } from '../../shared/gettext';
+import { messages, relayLocations } from '../../shared/gettext';
import log from '../../shared/logging';
import Connect from '../components/Connect';
import withAppContext, { IAppContext } from '../context';
@@ -9,32 +9,29 @@ import { RoutePath } from '../lib/routes';
import { IRelayLocationRedux, RelaySettingsRedux } from '../redux/settings/reducers';
import { IReduxState, ReduxDispatch } from '../redux/store';
-function getRelayName(
- relaySettings: RelaySettingsRedux,
- relayLocations: IRelayLocationRedux[],
-): string {
+function getRelayName(relaySettings: RelaySettingsRedux, locations: IRelayLocationRedux[]): string {
if ('normal' in relaySettings) {
const location = relaySettings.normal.location;
if (location === 'any') {
return 'Automatic';
} else if ('country' in location) {
- const country = relayLocations.find(({ code }) => code === location.country);
+ const country = locations.find(({ code }) => code === location.country);
if (country) {
- return country.name;
+ return relayLocations.gettext(country.name);
}
} else if ('city' in location) {
const [countryCode, cityCode] = location.city;
- const country = relayLocations.find(({ code }) => code === countryCode);
+ const country = locations.find(({ code }) => code === countryCode);
if (country) {
const city = country.cities.find(({ code }) => code === cityCode);
if (city) {
- return city.name;
+ return relayLocations.gettext(city.name);
}
}
} else if ('hostname' in location) {
const [countryCode, cityCode, hostname] = location.hostname;
- const country = relayLocations.find(({ code }) => code === countryCode);
+ const country = locations.find(({ code }) => code === countryCode);
if (country) {
const city = country.cities.find(({ code }) => code === cityCode);
if (city) {
@@ -46,7 +43,7 @@ function getRelayName(
// TRANSLATORS: %(hostname)s - a hostname
messages.pgettext('connect-container', '%(city)s (%(hostname)s)'),
{
- city: city.name,
+ city: relayLocations.gettext(city.name),
hostname,
},
);
diff --git a/gui/src/shared/gettext.ts b/gui/src/shared/gettext.ts
index 0416e8b1ce..9acdd80a55 100644
--- a/gui/src/shared/gettext.ts
+++ b/gui/src/shared/gettext.ts
@@ -6,7 +6,7 @@ const SOURCE_LANGUAGE = 'en';
function setErrorHandler(catalogue: Gettext) {
catalogue.on('error', (error) => {
- log.warn(`Gettext error: ${error}`);
+ log.debug(`Gettext error: ${error.message}`);
});
}
diff --git a/gui/src/shared/logging.ts b/gui/src/shared/logging.ts
index bfde85a9da..77d0168701 100644
--- a/gui/src/shared/logging.ts
+++ b/gui/src/shared/logging.ts
@@ -84,7 +84,7 @@ export class ConsoleOutput implements ILogOutput {
console.log(message);
break;
case LogLevel.debug:
- console.debug(message);
+ console.log(message);
break;
}
}