Skip to content

Commit

Permalink
Merge pull request #748 from HL7/2023-08-gg-log-suppression
Browse files Browse the repository at this point in the history
2023 08 gg log suppression
  • Loading branch information
grahamegrieve authored Aug 29, 2023
2 parents eaddc8d + 7ba8fc4 commit 5cabb76
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ public enum GenerationTool {
private String igName;
private IGBuildMode mode; // for the IG publication infrastructure

private IFetchFile fetcher = new SimpleFetcher(this);
private SimpleFetcher fetcher = new SimpleFetcher(this);
private SimpleWorkerContext context; //
private DataRenderer dr;
private InstanceValidator validator;
Expand Down Expand Up @@ -2755,6 +2755,16 @@ else if (p.getValue().equals("show-reference-messages"))
hasTranslations = true;
translationSupplements.add(p.getValue());
break;
case "logged-when-scanning":
if ("false".equals(p.getValue())) {
fetcher.setReport(false);
} else if ("stack".equals(p.getValue())) {
fetcher.setReport(true);
fetcher.setDebug(true);
} else {
fetcher.setReport(true);
}
break;
default:
if (!template.isParameter(pc)) {
unknownParams.add(pc+"="+p.getValue());
Expand Down Expand Up @@ -12009,7 +12019,7 @@ private static String nowAsDate(Calendar cal) {
}


public void setFetcher(IFetchFile theFetcher) {
public void setFetcher(SimpleFetcher theFetcher) {
fetcher = theFetcher;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ public class SimpleFetcher implements IFetchFile {
private ILoggingService log;
private String rootDir;
private FmlParser fp;
private boolean debug;
private boolean debug = false;
private boolean report = true;


public SimpleFetcher(ILoggingService log) {
Expand Down Expand Up @@ -333,9 +334,11 @@ public List<FetchedFile> scan(String sourceDir, IWorkerContext context, boolean
ok = true;
} catch (Exception e) {
if (!f.getName().startsWith("Binary-") && !f.getName().startsWith("binary-") ) { // we don't notify here because Binary is special.
log.logMessage(e.getMessage() +" loading "+f);
if (debug) {
e.printStackTrace();
if (report) {
log.logMessage(e.getMessage() +" loading "+f);
if (debug) {
e.printStackTrace();
}
}
}
}
Expand All @@ -349,9 +352,11 @@ public List<FetchedFile> scan(String sourceDir, IWorkerContext context, boolean
}
} catch (Exception e) {
if (!f.getName().startsWith("Binary-")) { // we don't notify here because Binary is special.
log.logMessage(e.getMessage() +" loading "+f);
if (debug) {
e.printStackTrace();
if (report) {
log.logMessage(e.getMessage() +" loading "+f);
if (debug) {
e.printStackTrace();
}
}
}
}
Expand All @@ -364,10 +369,13 @@ public List<FetchedFile> scan(String sourceDir, IWorkerContext context, boolean
ok = true;
} catch (Exception e) {
if (!f.getName().startsWith("Binary-")) { // we don't notify here because Binary is special.
log.logMessage(e.getMessage() +" loading "+f);
if (debug) {
e.printStackTrace();
if (report) {
log.logMessage(e.getMessage() +" loading "+f);
if (debug) {
e.printStackTrace();
}
}

}
}
}
Expand All @@ -382,9 +390,11 @@ public List<FetchedFile> scan(String sourceDir, IWorkerContext context, boolean
ok = true;
} catch (Exception e) {
if (!f.getName().startsWith("Binary-")) { // we don't notify here because Binary is special.
log.logMessage(e.getMessage() +" loading "+f);
if (debug) {
e.printStackTrace();
if (report) {
log.logMessage(e.getMessage() +" loading "+f);
if (debug) {
e.printStackTrace();
}
}
}
}
Expand Down Expand Up @@ -475,5 +485,21 @@ public void scanFolders(File dir, List<String> dirs) {
}
}


public boolean isDebug() {
return debug;
}

public void setDebug(boolean debug) {
this.debug = debug;
}

public boolean isReport() {
return report;
}

public void setReport(boolean report) {
this.report = report;
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ private void update(JsonObject json, String path, PackageList pl) {
if (e == null) {
e = new JsonObject();
json.forceArray("packages").add(e);
e.add("path", path);
} else {
e.clear();
}
e.add("path", path);
e.add("package-id", pl.pid());
e.add("title", pl.title());
e.add("canonical", pl.canonical());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,6 @@ public class AllGuidesTests {

private static final String VER = "1.0.53";

// private void test(String path) throws Exception {
// System.out.println("=======================================================================================");
// System.out.println("Publish IG "+path);
// Publisher pub = new Publisher();
// pub.setConfigFile(path);
// pub.setCacheOption(CacheOption.LEAVE);
// pub.execute();
// System.out.println("=======================================================================================");
// System.out.println("");
// }

private void testIg(String id, String path) throws Exception {
if (!igsPathExists()) {
Assertions.assertTrue(true);
Expand All @@ -44,7 +33,7 @@ private void testIg(String id, String path) throws Exception {
Publisher pub = new Publisher();
pub.setConfigFile(p);
pub.setTxServer(FhirSettings.getTxFhirDevelopment());
pub.setCacheOption(CacheOption.LEAVE);
pub.setCacheOption(CacheOption.CLEAR_ALL);
pub.execute();

System.out.println("===== Analysis ======================================================================");
Expand Down

0 comments on commit 5cabb76

Please sign in to comment.