/** * Convenience method. This prints out a short message describing the built-in options for this * class. Best called at the end of your custom help method. * Prints a header (informational line) if you wish. */ public static void defaultHelp(boolean printHeader) { if (printHeader) { say("Standard options are:"); } say(" -" + LOG_FILE_OPTION + " (-" + LOG_FILE_LONG_OPTION + ") -- set the name of the log file. Default is \"" + DEFAULT_LOG_FILE + "\" in the invocation directory."); say(" -" + CONFIG_FILE_OPTION + " (-" + CONFIG_FILE_LONG_OPTION + ") -- the configuration file for this application."); say(" -" + VERBOSE_OPTION + " (-" + VERBOSE_LONG_OPTION + ") -- set verbose on. This sends output to the console."); say(" -" + DEBUG_OPTION + " (-" + DEBUG_LONG_OPTION + ") -- set debug on. This will print out extra messages \n\t\t\tduring execution to the log file (and console, if verbose is enabled)"); say(" -" + HELP_OPTION + " (-" + HELP_LONG_OPTION + ") -- this message"); }
public void warn(String x) { if (isVerbose()) { say(x); } getMyLogger().warn(x); }
public void error(String x) { if (isVerbose()) { say(x); } getMyLogger().error(x); }
protected void parseCommandLine(String[] args) { CommandLineParser clp = new BasicParser(); try { cmd = clp.parse(getOptions(), args); } catch (UnrecognizedOptionException ux) { String err = "Error: unrecognized option + " + ux.getMessage() ; say(err); say("Invoke with -help for more"); if (isVerbose()) { ux.printStackTrace(); } throw new GeneralException(err, ux); } catch (ParseException e) { String err= "Error: could not parse a command line argument:" + e.getMessage(); say(err); if (isVerbose()) { e.printStackTrace(); } throw new GeneralException(err,e); } }
public void info(String x) { if (isVerbose()) { say(x); } getMyLogger().info(x); }
public void error(String x, Throwable t) { if (isVerbose()) { say(x); } getMyLogger().error(x,t); }
public void debug(String x) { if (isVerbose() && isDebugOn()) { say(x); } getMyLogger().debug(x); }