Examples of PrintStreamOutputLogger


Examples of net.bnubot.logging.PrintStreamOutputLogger

          break;
        case 'l':
          if(args[i].equals("-logfile")
          || args[i].equals("-log")) {
            try {
              Out.addOutputLogger(new PrintStreamOutputLogger(new PrintStream(new File(args[++i]))));
              logLocationSet = true;
            } catch (FileNotFoundException e) {
              Out.exception(e);
            }
            continue;
          }
          break;
        case 'n':
          if(args[i].equals("-nocli")) {
            PluginManager.setEnableCli(false);
            continue;
          }
          if(args[i].equals("-nogui")) {
            PluginManager.setEnableGui(false);
            continue;
          }
          break;
        case 's':
          if(args[i].equals("-stdout")) {
            Out.addOutputLogger(new PrintStreamOutputLogger(System.out));
            logLocationSet = true;
            continue;
          }
          break;
        case 'v':
          if(args[i].equals("-v") || args[i].equals("-version")) {
            System.out.println(CurrentVersion.version().toString());
            System.exit(0);
          }
          break;
        }
      }

      Out.error(Main.class, "Invalid argument: " + args[i]);
      System.exit(1);
    }

    // Set the default log file
    if(CurrentVersion.fromJar()) {
      try {
        File logFile = new File("log.txt");

        // Report errors for nightly builds
        if(CurrentVersion.version().getReleaseType().isNightly()
        && logFile.exists()
        && (logFile.length() > 0))
          ExceptionReporter.reportErrors(logFile);

        if(!logLocationSet)
          Out.addOutputLogger(new PrintStreamOutputLogger(new PrintStream(logFile)));
      } catch(Exception e) {
        Out.popupException(e);
      }
    } else {
      // Running in the debugger
      if(!logLocationSet)
        Out.addOutputLogger(new PrintStreamOutputLogger(System.out));
    }

    if(forceConfig) {
      try {
        new GlobalConfigurationFrame();
View Full Code Here

Examples of net.bnubot.logging.PrintStreamOutputLogger

public class ExceptionReporter {

  public static void main(String[] args) throws Exception {
    File logFile = new File("log.txt");

    Out.addOutputLogger(new PrintStreamOutputLogger(new PrintStream(logFile)));
    Out.info(Main.class, "asdf");
    Out.error(Main.class, "test");
    Out.exception(new Exception(new Exception("test")));

    ExceptionReporter.reportErrors(logFile);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.