binding.setProperty("jenkins", Jenkins.getActiveInstance()); IO io = new IO(new BufferedInputStream(stdin),stdout,stderr);
private void log(final String level, Object msg, Throwable cause) { assert level != null; assert msg != null; if (io == null) { synchronized (Logger.class) { if (io == null) { io = new IO(); } } } // Allow the msg to be a Throwable, and handle it properly if no cause is given if (cause == null) { if (msg instanceof Throwable) { cause = (Throwable) msg; msg = cause.getMessage(); } } Color color = GREEN; if (WARN.equals(level) || ERROR.equals(level)) { color = RED; } io.out.println(ansi().a(INTENSITY_BOLD).fg(color).a(level).reset().a(" [").a(name).a("] ").a(msg)); if (cause != null) { cause.printStackTrace(io.out); } io.flush(); }
/** * Check if the verbosity level is set to {@link Verbosity#VERBOSE}. */ public boolean isVerbose() { return getVerbosity() == Verbosity.VERBOSE; }
public DefaultTask(final Configuration config) { assert config != null; io = new IO(); Logger.io = io; if (config.get(VERBOSE, false)) { io.setVerbosity(IO.Verbosity.VERBOSE); } if (config.get(DEBUG, false)) { io.setVerbosity(IO.Verbosity.DEBUG); } if (config.get(QUIET, false)) { io.setVerbosity(IO.Verbosity.QUIET); } String color = config.get(COLOR, Boolean.TRUE.toString()); if (color != null) { Main.setColor(color); } String term = config.get(TERMINAL, (String)null); if (term != null) { Main.setTerminalType(term); } args = config.get(ARGS, (String)null); }
public DefaultTask(final Configuration config) { assert config != null; io = new IO(); Logger.io = io; if (config.get(VERBOSE, false)) { io.setVerbosity(IO.Verbosity.VERBOSE); } if (config.get(DEBUG, false)) { io.setVerbosity(IO.Verbosity.DEBUG); } if (config.get(QUIET, false)) { io.setVerbosity(IO.Verbosity.QUIET); } String color = config.get(COLOR, Boolean.TRUE.toString()); if (color != null) { Main.setColor(color); } String term = config.get(TERMINAL, (String)null); if (term != null) { Main.setTerminalType(term); } args = config.get(ARGS, (String)null); }
public Console() { this(new IO(System.in, System.out, System.err), STANDARD_INPUT_PROMPT, STANDARD_RESULT_PROMPT); }
public DefaultTask(final Configuration config) { assert config != null; io = new IO(); Logger.io = io; if (config.get(VERBOSE, false)) { io.setVerbosity(IO.Verbosity.VERBOSE); } if (config.get(DEBUG, false)) { io.setVerbosity(IO.Verbosity.DEBUG); } if (config.get(QUIET, false)) { io.setVerbosity(IO.Verbosity.QUIET); } String color = config.get(COLOR, Boolean.TRUE.toString()); if (color != null) { Main.setColor(color); } String term = config.get(TERMINAL, (String)null); if (term != null) { Main.setTerminalType(term); } args = config.get(ARGS, (String)null); }
/** * Check if the verbosity level is set to {@link Verbosity#QUIET}. */ public boolean isQuiet() { return getVerbosity() == Verbosity.QUIET; }
public void start() { System.setProperty("plugins", "v3d3"); PipedInputStream in = new PipedInputStream(); replaceSystemIn(in); try { input = new PrintWriter(new PipedOutputStream(in)); } catch (IOException e) { throw new RuntimeException(e); } console = new Thread(() -> new Console(new IO(), new ArrayList<>(), true)); console.start(); }
public DefaultTask(final Configuration config) { assert config != null; io = new IO(); Logger.io = io; if (config.get(VERBOSE, false)) { io.setVerbosity(IO.Verbosity.VERBOSE); } if (config.get(DEBUG, false)) { io.setVerbosity(IO.Verbosity.DEBUG); } if (config.get(QUIET, false)) { io.setVerbosity(IO.Verbosity.QUIET); } String color = config.get(COLOR, Boolean.TRUE.toString()); if (color != null) { Main.setColor(color); } String term = config.get(TERMINAL, (String)null); if (term != null) { Main.setTerminalType(term); } args = config.get(ARGS, (String)null); }
/** * Check if the verbosity level is set to {@link Verbosity#INFO}. */ public boolean isInfo() { return getVerbosity() == Verbosity.INFO; }
private Groovysh createShell() { if (welcomeMessage != null) { writer.println(SEPARATOR_BAR); writer.println(welcomeMessage); writer.println(SEPARATOR_BAR); } binding.setVariable(OUT_KEY, out); final CompilerConfiguration config = new CompilerConfiguration(); final GroovyClassLoader loader = new GroovyClassLoader(this.getClass().getClassLoader(), config); final Groovysh shell = new Groovysh(loader, binding, new IO(in, out, out)); writer.flush(); return shell; }
public DefaultTask(final Configuration config) { assert config != null; io = new IO(); Logger.io = io; if (config.get(VERBOSE, false)) { io.setVerbosity(IO.Verbosity.VERBOSE); } if (config.get(DEBUG, false)) { io.setVerbosity(IO.Verbosity.DEBUG); } if (config.get(QUIET, false)) { io.setVerbosity(IO.Verbosity.QUIET); } String color = config.get(COLOR, Boolean.TRUE.toString()); if (color != null) { Main.setColor(color); } String term = config.get(TERMINAL, (String)null); if (term != null) { Main.setTerminalType(term); } args = config.get(ARGS, (String)null); }
/** * Check if the verbosity level is set to {@link Verbosity#DEBUG}. * * <p>For general usage, when debug output is required, it is better * to use the logging facility instead. */ public boolean isDebug() { return getVerbosity() == Verbosity.DEBUG; }
private Groovysh createShell() { if (welcomeMessage != null) { writer.println(SEPARATOR_BAR); writer.println(welcomeMessage); writer.println(SEPARATOR_BAR); } binding.setVariable(OUT_KEY, out); final CompilerConfiguration config = new CompilerConfiguration(); final GroovyClassLoader loader = new GroovyClassLoader(this.getClass().getClassLoader(), config); final Groovysh shell = new Groovysh(loader, binding, new IO(in, out, out)); writer.flush(); return shell; }
public DefaultTask(final Configuration config) { assert config != null; io = new IO(); Logger.io = io; if (config.get(VERBOSE, false)) { io.setVerbosity(IO.Verbosity.VERBOSE); } if (config.get(DEBUG, false)) { io.setVerbosity(IO.Verbosity.DEBUG); } if (config.get(QUIET, false)) { io.setVerbosity(IO.Verbosity.QUIET); } String color = config.get(COLOR, Boolean.TRUE.toString()); if (color != null) { Main.setColor(color); } String term = config.get(TERMINAL, (String)null); if (term != null) { Main.setTerminalType(term); } args = config.get(ARGS, (String)null); }
private void log(final String level, Object msg, Throwable cause) { assert level != null; assert msg != null; if (io == null) { io = new IO(); } // Allow the msg to be a Throwable, and handle it properly if no cause is given if (cause == null) { if (msg instanceof Throwable) { cause = (Throwable) msg; msg = cause.getMessage(); } } Color color = GREEN; if (WARN.equals(level) || ERROR.equals(level)) { color = RED; } io.out.println(ansi().a(INTENSITY_BOLD).a(color).a(level).reset().a(" [").a(name).a("] ").a(msg)); if (cause != null) { cause.printStackTrace(io.out); } try { io.flush(); } catch (IOException io) { throw new RuntimeException(io); } }