Skip to content

Commit

Permalink
build log output cosmetics
Browse files Browse the repository at this point in the history
  • Loading branch information
Mizzick committed Jun 27, 2017
1 parent b45b9a6 commit 2b0d371
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions Compiler/src/main/java/com/adguard/compiler/FilterUtils.java
Expand Up @@ -82,6 +82,7 @@ public static void updateLocalFilters(File source, Browser browser) throws IOExc
File filtersDir = FileUtil.getFiltersDir(source, browser);
File dest = new File(source, "tmp-filters");

log.info("Start downloading local filters");
List<File> filesToCopy = new ArrayList<File>();
try {
for (int filterId = 1; filterId <= LAST_ADGUARD_FILTER_ID; filterId++) {
Expand All @@ -96,6 +97,8 @@ public static void updateLocalFilters(File source, Browser browser) throws IOExc
for (File file : filesToCopy) {
FileUtils.copyFileToDirectory(file, filtersDir);
}

log.info("Filters updated");
} finally {
FileUtils.deleteDirectory(dest);
}
Expand All @@ -114,15 +117,15 @@ public static void updateGroupsAndFiltersMetadata(File source, Browser browser)
File metadataFile = new File(filtersDir, "filters.json");
File metadataI18nFile = new File(filtersDir, "filters_i18n.json");

log.info("Start download filters metadata");
log.info("Start downloading filters metadata");
String response = UrlUtils.downloadString(new URL(getFiltersMetadataDownloadUrl(browser, false)), "utf-8");
FileUtils.write(metadataFile, response, "utf-8");
log.info("Write filters metadata to " + metadataFile);
log.info("Filters metadata saved to " + metadataFile);

log.info("Start download filters i18n metadata");
log.info("Start downloading filters i18n metadata");
response = UrlUtils.downloadString(new URL(getFiltersMetadataDownloadUrl(browser, true)), "utf-8");
FileUtils.write(metadataI18nFile, response, "utf-8");
log.info("Write filters i18n metadata to " + metadataI18nFile);
log.info("Filters i18n metadata saved to " + metadataI18nFile);
}

/**
Expand Down Expand Up @@ -158,6 +161,8 @@ public static void updateLocalScriptRules(File source, Browser browser) throws I
scriptRulesObject.addRawRules(scriptRules);
String json = OBJECT_MAPPER.writer(prettyPrinter).writeValueAsString(scriptRulesObject);
FileUtils.writeStringToFile(localScriptRulesFile, json, "utf-8");

log.info("Local script rules updated");
}

/**
Expand All @@ -172,7 +177,7 @@ public static void updateLocalScriptRules(File source, Browser browser) throws I
*/
private static File downloadFilterFile(File dest, int filterId, String filterDownloadUrl, String fileName) throws IOException {

log.debug("Start download filter " + filterId + " from " + filterDownloadUrl);
log.debug("Start downloading filter " + filterId + " from " + filterDownloadUrl);

String downloadUrl = String.format(filterDownloadUrl, filterId);
String response = UrlUtils.downloadString(new URL(downloadUrl), "UTF-8");
Expand All @@ -182,7 +187,7 @@ private static File downloadFilterFile(File dest, int filterId, String filterDow
File filterFile = new File(dest, fileName);
FileUtils.write(filterFile, response, "utf-8");

log.debug("Filter " + filterId + " download successfully");
log.debug("Filter " + filterId + " downloaded successfully");
return filterFile;
}

Expand Down

0 comments on commit 2b0d371

Please sign in to comment.