APISonar


com.google.gwt.core.ext.TreeLogger.log

> com > google > gwt > core > ext > TreeLogger > log
com APIs google APIs gwt APIs core APIs ext APIs TreeLogger APIs log APIs

Example 1
private TreeLogger log;

  private void doLog(TreeLogger.Type type, Object message, Throwable t) {
    String msg = message.toString();
    log.log(type, msg, t);
  }
Example 2
public void log(TreeLogger logger, Throwable caught) {
    if (logger.isLoggable(type)) {
      logger.log(type, new String(fmtParts[0]), caught);
    }
  }
Example 3
private static void copyGeneratedFile(TreeLogger log, EmittedArtifact src,
      OutputFileSet dest, String destPrefix) throws UnableToCompleteException {

    String newPath = destPrefix + src.getPartialPath();
    try {
      OutputStream out = dest.openForWrite(newPath, src.getLastModified());
      try {
        src.writeTo(log, out);
      } finally {
        out.close();
      }
    } catch (IOException e) {
      log.log(TreeLogger.WARN, "Error emitting artifact: " + newPath, e);
    }
  }
Example 4
private final TreeLogger logger;

  public void start() {
    try {
      Stopwatch watch = Stopwatch.createStarted();
      logger.log(Type.INFO, "Running CodeServer with parameters: " + codeServerArgs);
      runCodeServer(codeServerArgs.toArray(new String[0]));
      logger.log(Type.INFO, "Code server started in " + watch + " ms");
    } catch (Exception e) {
      logger.log(Type.INFO, "Unable to start Code server");
      throw new RuntimeException(e);
    }
  }
Example 5
private final TreeLogger logger;

  synchronized Future<Void> enqueueAsyncDeleteDiskCaches() {
    return executorService.submit(new Callable<Void>() {
      @Override
      public Void call() {
        for (File cacheFile : minimalRebuildCacheDir.listFiles()) {
          if (!cacheFile.delete()) {
            logger.log(TreeLogger.WARN, "Couldn't delete " + cacheFile);
          }
        }
        return null;
      }
    });
  }
Example 6
static PrecompilationResult readPrecompilationFile(TreeLogger logger,
      File precompilationFile) {
    PrecompilationResult precompileResults = null;
    try {
      precompileResults = Util.readFileAsObject(precompilationFile,
          PrecompilationResult.class);
    } catch (IOException e) {
      logger.log(TreeLogger.ERROR, "Failed to read "
          + precompilationFile + "\nHas Precompile been run?");
    } catch (ClassNotFoundException e) {
      logger.log(TreeLogger.ERROR, "Failed to read "
          + precompilationFile, e);
    }
    return precompileResults;
  }
Example 7
public T newInstance(TreeLogger logger) throws UnableToCompleteException {
    try {
      return Util.readFileAsObject(backingFile, clazz);
    } catch (ClassNotFoundException e) {
      logger.log(TreeLogger.ERROR, "Missing class definition", e);
      throw new UnableToCompleteException();
    } catch (IOException e) {
      logger.log(TreeLogger.ERROR, "Unable to instantiate object", e);
      throw new UnableToCompleteException();
    }
  }
Example 8
private void doReport(TreeLogger logger, Type level,
      Map<JClassType, List<Problem>> problems) {
    for (List<Problem> problemList : problems.values()) {
      for (Problem problem : problemList) {
        if (problem.hasSubMessages()) {
          TreeLogger sublogger = logger.branch(level, problem.getPrimaryMessage());
          for (String sub : problem.getSubMessages()) {
            sublogger.log(level, sub);
          }
        } else {
          logger.log(level, problem.getPrimaryMessage());
        }
      }
    }
  }
Example 9
public static void logURLs(TreeLogger logger, TreeLogger.Type type, URL[] urls) {
    for (int i = 0; i < urls.length; i++) {
      URL url = urls[i];
      logger.log(type, url.toExternalForm(), null);
    }
  }
Example 10
private TreeLogger logger = null;

  private void createPublicResource(String partialPath, String contents) {
    try {
      OutputStream outStream = context.tryCreateResource(logger, partialPath);
      outStream.write(contents.getBytes());
      context.commitResource(logger, outStream);
    } catch (UnableToCompleteException e) {
      logger.log(TreeLogger.ERROR, "Failed while writing", e);
    } catch (IOException e) {
      logger.log(TreeLogger.ERROR, "Failed while writing", e);
    }
  }
Example 11
private final TreeLogger logger;

  public void logLocation(TreeLogger.Type type, XMLElement context,
      String message) {
    message += locationOf(context);
    logger.log(type, message);
  }
Example 12
protected void log3(TreeLogger logger, Object arg1, Object arg2, Object arg3,
      Formatter fmt1, Formatter fmt2, Formatter fmt3, Throwable caught) {
    if (logger.isLoggable(type)) {
      logger.log(type, compose3(arg1, arg2, arg3, fmt1, fmt2, fmt3), caught);
    }
  }
Example 13
public void removeSourceArtifacts(TreeLogger logger) {
    logger.log(Type.DEBUG, "removing source artifacts");

    for (EmittedArtifact artifact : generatedArtifacts.find(EmittedArtifact.class)) {
      if (artifact.getVisibility() == Visibility.Source) {
        generatedArtifacts.remove(artifact);
      }
    }
  }
Example 14
private final TreeLogger logger;

  synchronized boolean deleteUnlessOpen(File cacheFile) {
    if (isOpen(cacheFile)) {
      return false;
    }
    logger.log(Type.TRACE, "Deleting file: " + cacheFile);
    boolean deleted = cacheFile.delete();
    if (!deleted) {
      logger.log(Type.WARN, "Unable to delete file: " + cacheFile);
    }
    return deleted;
  }
Example 15
private final TreeLogger logger;

  boolean recompile(Map<String, String> bindingProperties) {
    try {
      current.set(recompiler.compile(bindingProperties));
      return true;
    } catch (UnableToCompleteException e) {
      logger.log(TreeLogger.Type.WARN, "continuing to serve previous version");
      return false;
    }
  }
Example 16
public static Reader createReader(TreeLogger logger, URL url)
      throws UnableToCompleteException {
    try {
      return new InputStreamReader(url.openStream());
    } catch (IOException e) {
      logger.log(TreeLogger.ERROR, "Unable to open resource: " + url, e);
      throw new UnableToCompleteException();
    }
  }
Example 17
private final TreeLogger logger;

  public boolean disconnect() {
    try {
      return browserChannelClient.disconnectFromHost();
    } catch (IOException e) {
      logger.log(TreeLogger.ERROR, "IOException returned from disconnect "
          + e.getMessage(), e);
      return false;
    }
  }
Example 18
private final TreeLogger logger;

  private void poison(String message) {
    logger.log(TreeLogger.ERROR, message);
    poisoned = true;
  }
Example 19
private void resetLinkers(TreeLogger logger) throws UnableToCompleteException {
    linkers = new Linker[linkerClasses.size()];
    int i = 0;
    for (Class<? extends Linker> linkerClass : linkerClasses) {
      try {
        linkers[i++] = linkerClass.newInstance();
      } catch (InstantiationException e) {
        logger.log(TreeLogger.ERROR, "Unable to create Linker", e);
        throw new UnableToCompleteException();
      } catch (IllegalAccessException e) {
        logger.log(TreeLogger.ERROR, "Unable to create Linker", e);
        throw new UnableToCompleteException();
      }
    }
  }
Example 20
public static void copy(TreeLogger logger, InputStream is, OutputStream os)
      throws UnableToCompleteException {
    try {
      copy(is, os);
    } catch (IOException e) {
      logger.log(TreeLogger.ERROR, "Error during copy", e);
      throw new UnableToCompleteException();
    }
  }
Example 21
private final TreeLogger logger;

  private void runCodeServer(String[] mainArgs) throws Exception {
    // Using reflection so as we don't create a circular dependency between
    // dev.jar && codeserver.jar
    Method mainMethod;
    try {
      Class<?> clazz = Class.forName("com.google.gwt.dev.codeserver.CodeServer");
      mainMethod = clazz.getMethod("main", String[].class);
    } catch (ClassNotFoundException e) {
      logger.log(TreeLogger.ERROR, "Unable to find main() method for Super Dev Mode "
          + "code server. Hint: verify that gwt-codeserver.jar is in your classpath.");
      throw e;
    }

    mainMethod.invoke(null, new Object[] {mainArgs});
  }
Example 22
private static byte[] createImageBytes(TreeLogger logger,
      BufferedImage bundledImage) throws UnableToCompleteException {
    byte[] imageBytes;

    try {
      ByteArrayOutputStream byteOutputStream = new ByteArrayOutputStream();
      ImageIO.write(bundledImage, BUNDLE_FILE_TYPE, byteOutputStream);
      imageBytes = byteOutputStream.toByteArray();
    } catch (IOException e) {
      logger.log(TreeLogger.ERROR,
          "Unable to generate file name for image bundle file", null);
      throw new UnableToCompleteException();
    }
    return imageBytes;
  }
Example 23
public RegexFilter(TreeLogger logger, List<String> values) throws UnableToCompleteException {
    this();
    try {
      addAll(values);
    } catch (IllegalArgumentException e) {
      logger.log(TreeLogger.ERROR, "Got malformed filter entry\n" + e.getMessage());
      throw new UnableToCompleteException();
    }

    if (logger.isLoggable(TreeLogger.DEBUG)) {
      for (String regex : values) {
        logger.log(TreeLogger.DEBUG, "Got filter entry '" + regex + "'");
      }
    }
  }
Example 24
private void logDifferencesBetweenCurrentAndCachedTypes(TreeLogger logger, JType[] currentTypes,
      Set<String> cachedTypes) {

    Set<String> remainingCachedTypes = new HashSet<String>(cachedTypes);
    for (JType currentType : currentTypes) {
      String sourceName = currentType.getQualifiedSourceName();
      if (!remainingCachedTypes.remove(sourceName)) {
        logger.log(TreeLogger.TRACE, "New type " + sourceName + " not in cached list");
      }
    }

    for (String remainingCachedType : remainingCachedTypes) {
      logger.log(TreeLogger.TRACE, "Cached type " + remainingCachedType + " not in new list");
    }
  }
Example 25
public static void notifyBlacklistedHost(String blacklistRuleFound,
      String url, TreeLogger header, TreeLogger.Type msgType) {
    TreeLogger reason = header.branch(msgType, "reason: " + url
        + " is blacklisted", null);
    reason.log(msgType, "To fix: remove \"" + blacklistRuleFound
        + "\" from system property gwt.hosts.blacklist", null);
  }