-
Notifications
You must be signed in to change notification settings - Fork 258
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4063 from kwvanderlinde/experiment/reduce-connect…
…ion-logging Clean up logging
- Loading branch information
Showing
34 changed files
with
415 additions
and
271 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
src/main/java/net/rptools/maptool/client/DeveloperOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
* This software Copyright by the RPTools.net development team, and | ||
* licensed under the Affero GPL Version 3 or, at your option, any later | ||
* version. | ||
* | ||
* MapTool Source Code is distributed in the hope that it will be | ||
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty | ||
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* | ||
* You should have received a copy of the GNU Affero General Public | ||
* License * along with this source Code. If not, please visit | ||
* <http://www.gnu.org/licenses/> and specifically the Affero license | ||
* text at <http://www.gnu.org/licenses/agpl.html>. | ||
*/ | ||
package net.rptools.maptool.client; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.prefs.Preferences; | ||
import net.rptools.maptool.language.I18N; | ||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
|
||
public class DeveloperOptions { | ||
private static final Logger log = LogManager.getLogger(DeveloperOptions.class); | ||
private static final Preferences prefs = | ||
Preferences.userRoot().node(AppConstants.APP_NAME + "/prefs"); | ||
|
||
public enum Toggle { | ||
/** | ||
* When enabled, make auto-save 60x more frequent by interpreting the user-provided value as | ||
* seconds instead of minutes. | ||
*/ | ||
AutoSaveMeasuredInSeconds("autoSaveMeasuredInSeconds"), | ||
|
||
/** When enabled, draw boundaries around each partition. */ | ||
ShowPartitionDrawableBoundaries("showPartitionDrawableBoundaries"), | ||
|
||
/** | ||
* When enabled, shows F, G, H scores for each cell encountered during pathfinding, as well as | ||
* blocked moved. | ||
*/ | ||
ShowAiDebugging("showAiDebugging"), | ||
|
||
/** When enabled, recalculates the grid shape each time it is needed. */ | ||
IgnoreGridShapeCache("ignoreGridShapeCache"), | ||
; | ||
|
||
private final String key; | ||
|
||
Toggle(String key) { | ||
this.key = key; | ||
} | ||
|
||
public String getKey() { | ||
return key; | ||
} | ||
|
||
public boolean isEnabled() { | ||
return prefs.getBoolean(key, true); | ||
} | ||
|
||
public void setEnabled(boolean enabled) { | ||
prefs.putBoolean(key, enabled); | ||
} | ||
|
||
public String getLabel() { | ||
return I18N.getText(String.format("Preferences.developer.%s.label", key)); | ||
} | ||
|
||
public String getTooltip() { | ||
return I18N.getText(String.format("Preferences.developer.%s.tooltip", key)); | ||
} | ||
} | ||
|
||
public static List<Toggle> getEnabledOptions() { | ||
return Arrays.stream(Toggle.values()).filter(Toggle::isEnabled).toList(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.