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

log to console checkbox now reflects value in settings #42

Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class TelegramBotGlobalConfiguration extends GlobalConfiguration {
final static String PLUGIN_DISPLAY_NAME = "TelegramBot";
private final Map<String, String> botStrings;

private Boolean shouldLogToConsole;
private Boolean shouldLogToConsole = Boolean.TRUE;
private String botToken;
private String botName;
private String usernames;
Expand Down Expand Up @@ -72,7 +72,7 @@ public boolean configure(StaplerRequest req, JSONObject formData) throws FormExc
StaplerRequestContainer.req = req;

// Getting simple params from formData
setLogToConsole(formData.getBoolean("shouldLogToConsole"));
setShouldLogToConsole(formData.getBoolean("shouldLogToConsole"));
setBotToken(formData.getString("botToken"));
setBotName(formData.getString("botName"));

Expand Down Expand Up @@ -109,11 +109,11 @@ public Map<String, String> getBotStrings() {
return botStrings;
}

public Boolean shouldLogToConsole() {
public Boolean isShouldLogToConsole() {
return shouldLogToConsole;
}

public void setLogToConsole(Boolean shouldLogToConsole) {
public void setShouldLogToConsole(Boolean shouldLogToConsole) {
this.shouldLogToConsole = shouldLogToConsole;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public void sendMessage(
LOG.log(Level.SEVERE, "Error while sending the message", e);
}

if (CONFIG.shouldLogToConsole()) taskListener.getLogger().println(logMessage);
if (CONFIG.isShouldLogToConsole()) taskListener.getLogger().println(logMessage);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

<f:entry title="Log to console" field="shouldLogToConsole"
description="Check if we should log messages to Jenkins console">
<f:checkbox default="true"/>
<f:checkbox/>
</f:entry>

<f:entry title="Telegram Bot name" field="botName" description="Paste your bot name">
Expand Down