client: make error logging opt out
This commit is contained in:
@@ -27,6 +27,7 @@ package net.runelite.client;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Properties;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class RuneLiteProperties
|
||||
{
|
||||
@@ -40,7 +41,7 @@ public class RuneLiteProperties
|
||||
private static final String GITHUB_LINK = "runelite.github.link";
|
||||
private static final String WIKI_LINK = "runelite.wiki.link";
|
||||
private static final String PATREON_LINK = "runelite.patreon.link";
|
||||
private static final String LAUNCHER_VERSION_PROPERTY = "runelite.launcher.version";
|
||||
private static final String LAUNCHER_VERSION_PROPERTY = "launcher.version";
|
||||
private static final String TROUBLESHOOTING_LINK = "runelite.wiki.troubleshooting.link";
|
||||
private static final String BUILDING_LINK = "runelite.wiki.building.link";
|
||||
private static final String DNS_CHANGE_LINK = "runelite.dnschange.link";
|
||||
@@ -129,4 +130,11 @@ public class RuneLiteProperties
|
||||
{
|
||||
return properties.getProperty(DNS_CHANGE_LINK);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static String getLauncherVersion()
|
||||
{
|
||||
String launcherVersion = properties.getProperty(LAUNCHER_VERSION_PROPERTY);
|
||||
return launcherVersion.equals("-1") ? null : launcherVersion;
|
||||
}
|
||||
}
|
||||
@@ -50,6 +50,29 @@ public interface OpenOSRSConfig extends Config
|
||||
}
|
||||
}
|
||||
|
||||
@ConfigTitleSection(
|
||||
keyName = "logTitle",
|
||||
name = "Error data",
|
||||
description = "",
|
||||
position = 1
|
||||
)
|
||||
default Title logTitle()
|
||||
{
|
||||
return new Title();
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 3,
|
||||
keyName = "shareLogs",
|
||||
name = "Anonymous error data",
|
||||
description = "Share anonymous error data with the OpenOSRS developers",
|
||||
titleSection = "logTitle"
|
||||
)
|
||||
default boolean shareLogs()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigTitleSection(
|
||||
keyName = "pluginsTitle",
|
||||
name = "Plugins",
|
||||
|
||||
@@ -10,9 +10,12 @@ import io.sentry.Sentry;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.events.Event;
|
||||
import net.runelite.client.RuneLiteProperties;
|
||||
import net.runelite.client.config.OpenOSRSConfig;
|
||||
|
||||
@Slf4j
|
||||
@Singleton
|
||||
@@ -22,6 +25,9 @@ public class EventBus implements EventBusInterface
|
||||
private Map<Class<?>, Relay<Object>> subjectList = new HashMap<>();
|
||||
private Map<Object, CompositeDisposable> subscriptionsMap = new HashMap<>();
|
||||
|
||||
@Inject
|
||||
private OpenOSRSConfig openOSRSConfig;
|
||||
|
||||
@NonNull
|
||||
private <T> Relay<Object> getSubject(Class<T> eventClass)
|
||||
{
|
||||
@@ -55,7 +61,12 @@ public class EventBus implements EventBusInterface
|
||||
.cast(eventClass) // Cast it for easier usage
|
||||
.subscribe(action, error ->
|
||||
{
|
||||
Sentry.capture(error);
|
||||
log.error("Exception in eventbus", error);
|
||||
|
||||
if (RuneLiteProperties.getLauncherVersion() != null && openOSRSConfig.shareLogs())
|
||||
{
|
||||
Sentry.capture(error);
|
||||
}
|
||||
});
|
||||
|
||||
getCompositeDisposable(lifecycle).add(disposable);
|
||||
@@ -77,7 +88,12 @@ public class EventBus implements EventBusInterface
|
||||
.doFinally(() -> unregister(lifecycle))
|
||||
.subscribe(action, error ->
|
||||
{
|
||||
Sentry.capture(error);
|
||||
log.error("Exception in eventbus", error);
|
||||
|
||||
if (RuneLiteProperties.getLauncherVersion() != null && openOSRSConfig.shareLogs())
|
||||
{
|
||||
Sentry.capture(error);
|
||||
}
|
||||
});
|
||||
|
||||
getCompositeDisposable(lifecycle).add(disposable);
|
||||
|
||||
Reference in New Issue
Block a user