Skip to content

Commit

Permalink
fix #23849 - provide option to reduce loglevel to warnings
Browse files Browse the repository at this point in the history
git-svn-id: https://josm.openstreetmap.de/svn/trunk@19177 0c6e7542-c601-0410-84e7-c038aed88b3b
  • Loading branch information
stoecker committed Aug 9, 2024
1 parent d8cb740 commit b29a864
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/org/openstreetmap/josm/data/validation/ValidatorCLI.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,17 @@ private enum Option {
OUTPUT(true, 'o', OptionParser.OptionCount.MULTIPLE),
/** --change-file=<change-file> Add a change file */
CHANGE_FILE(true, 'c', OptionParser.OptionCount.MULTIPLE),
/** --warn Set logging level to warn */
WARN(false, '*'),
/** --debug Set logging level to debug */
DEBUG(false, '*'),
/** --trace Set logging level to trace */
TRACE(false, '*'),
/** --language=<language> Set the language */
/** --language=<language> Set the language */
LANGUAGE(true, 'l'),
/** --load-preferences=<url-to-xml> Changes preferences according to the XML file */
/** --load-preferences=<url-to-xml> Changes preferences according to the XML file */
LOAD_PREFERENCES(true, 'p'),
/** --set=<key>=<value> Set preference key to value */
/** --set=<key>=<value> Set preference key to value */
SET(true, 's');

private final String name;
Expand Down Expand Up @@ -412,6 +414,9 @@ private void handleOption(final Option option) {
showHelp();
Lifecycle.exitJosm(true, 0);
break;
case WARN:
this.logLevel = Logging.LEVEL_WARN;
break;
case DEBUG:
this.logLevel = Logging.LEVEL_DEBUG;
break;
Expand Down
1 change: 1 addition & 0 deletions src/org/openstreetmap/josm/gui/MainApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -706,6 +706,7 @@ static String getHelp() {
"\t--version "+tr("Displays the JOSM version and exits")+"\n\n"+
"\t--status-report "+ShowStatusReportAction.ACTION_DESCRIPTION+"\n\n"+
"\t--debug "+tr("Print debugging messages to console")+"\n\n"+
"\t--warn "+tr("Print only warning or error messages to console")+"\n\n"+
"\t--skip-plugins "+tr("Skip loading plugins")+"\n\n"+
"\t--offline=" + Arrays.stream(OnlineResource.values()).map(OnlineResource::name).collect(
Collectors.joining("|", "<", ">")) + "\n" +
Expand Down
4 changes: 4 additions & 0 deletions src/org/openstreetmap/josm/gui/ProgramArguments.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public enum Option {
VERSION(false),
/** {@code --status-report} Show status report with useful information that can be attached to bugs */
STATUS_REPORT(false),
/** --warn Print only warning messages to console */
WARN(false),
/** --debug Print debugging messages to console */
DEBUG(false),
/** --trace Print detailed debugging messages to console */
Expand Down Expand Up @@ -186,6 +188,8 @@ public Level getLogLevel() {
return Logging.LEVEL_TRACE;
} else if (hasOption(Option.DEBUG)) {
return Logging.LEVEL_DEBUG;
} else if (hasOption(Option.WARN)) {
return Logging.LEVEL_WARN;
} else {
return Logging.LEVEL_INFO;
}
Expand Down

0 comments on commit b29a864

Please sign in to comment.