Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add debug flag #38

Merged
merged 4 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- Report dependencies ([#22](https://github.com/getsentry/sentry-maven-plugin/pull/22))
- Send telemetry data for plugin usage ([#28](https://github.com/getsentry/sentry-maven-plugin/pull/28))
- This will collect errors and timings of the plugin and its tasks (anonymized, except the sentry org id), so we can better understand how the plugin is performing. If you wish to opt-out of this behavior, set `<skipTelemetry>true</skipTelemetry>` in the sentry plugin configuration block.
- Add `debug` flag ([#38](https://github.com/getsentry/sentry-maven-plugin/pull/38))

### Dependencies

Expand Down
2 changes: 2 additions & 0 deletions examples/sentry-maven-plugin-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
<version>1.0-SNAPSHOT</version>
<extensions>true</extensions>
<configuration>
<!-- for showing debug output -->
<debug>false</debug>
<!-- for showing output of sentry-cli -->
<debugSentryCli>true</debugSentryCli>

Expand Down
5 changes: 5 additions & 0 deletions src/main/java/io/sentry/config/ConfigParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class ConfigParser {
private static final @NotNull String SKIP_REPORT_DEPENDENCIES_FLAG = "skipReportDependencies";
private static final @NotNull String SKIP_SOURCE_BUNDLE_FLAG = "skipSourceBundle";
private static final @NotNull String DEBUG_SENTRY_CLI_FLAG = "debugSentryCli";
private static final @NotNull String DEBUG_FLAG = "debug";
private static final @NotNull String ORG_OPTION = "org";
private static final @NotNull String PROJECT_OPTION = "project";
private static final @NotNull String URL_OPTION = "url";
Expand Down Expand Up @@ -65,6 +66,10 @@ public class ConfigParser {
dom.getChild(DEBUG_SENTRY_CLI_FLAG) != null
&& Boolean.parseBoolean(dom.getChild(DEBUG_SENTRY_CLI_FLAG).getValue()));

pluginConfig.setDebug(
dom.getChild(DEBUG_FLAG) != null
&& Boolean.parseBoolean(dom.getChild(DEBUG_FLAG).getValue()));

pluginConfig.setOrg(
dom.getChild(ORG_OPTION) == null ? null : dom.getChild(ORG_OPTION).getValue());

Expand Down
13 changes: 12 additions & 1 deletion src/main/java/io/sentry/config/PluginConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@ public class PluginConfig {
public static final @NotNull String DEFAULT_SKIP_TELEMETRY_STRING = "false";
public static final boolean DEFAULT_DEBUG_SENTRY_CLI = false;
public static final @NotNull String DEFAULT_DEBUG_SENTRY_CLI_STRING = "false";
public static final boolean DEFAULT_DEBUG = false;
public static final @NotNull String DEFAULT_DEBUG_STRING = "false";

private boolean skip = DEFAULT_SKIP;
private boolean skipAutoInstall = DEFAULT_SKIP_AUTO_INSTALL;
private boolean skipTelemetry = DEFAULT_SKIP_TELEMETRY;
private boolean skipReportDependencies = DEFAULT_SKIP_REPORT_DEPENDENCIES;
private boolean skipSourceBundle = DEFAULT_SKIP_SOURCE_BUNDLE;
private boolean debugSentryCli = DEFAULT_DEBUG_SENTRY_CLI;
private boolean debug = DEFAULT_DEBUG;

private @Nullable String org;
private @Nullable String project;
Expand All @@ -35,7 +38,15 @@ public void setDebugSentryCli(final boolean debugSentryCli) {
}

public boolean isDebugSentryCli() {
return debugSentryCli;
return debugSentryCli || debug;
}

public void setDebug(final boolean debug) {
this.debug = debug;
}

public boolean isDebug() {
return debug;
}

public void setSentryCliExecutablePath(final @Nullable String sentryCliExecutablePath) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public void start(
Sentry.init(
(options) -> {
options.setDsn(SENTRY_SAAS_DSN);
options.setDebug(true);
options.setDebug(pluginConfig.isDebug());
options.setEnablePrettySerializationOutput(false);
options.setEnvironment("JVM");
options.setSendModules(false);
Expand Down