Skip to content

Commit

Permalink
Rename timelineEvent and logEntry report key (#337)
Browse files Browse the repository at this point in the history
Signed-off-by: lisrte <[email protected]>
  • Loading branch information
Lisrte authored Mar 20, 2024
1 parent a8dd905 commit 8201ac5
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,12 @@ private CommonReports() {
}

public static Reporter createDynawoLogReporter(Reporter reporter) {
return reporter.createSubReporter("dynawoLog",
"Dynawo Log");
return reporter.createSubReporter("dynawoLog", "Dynawo Log");
}

public static void reportTimelineEvent(Reporter reporter, TimelineEntry timelineEntry) {
public static void reportTimelineEntry(Reporter reporter, TimelineEntry timelineEntry) {
reporter.report(Report.builder()
.withKey("DynawoTimelineEvent")
.withKey("dynawoTimelineEntry")
.withDefaultMessage("[t=${time}] ${message} on equipment '${identifiableId}'")
.withTypedValue("time", timelineEntry.time(), TIME_MS)
.withTypedValue("identifiableId", timelineEntry.modelName(), ID)
Expand All @@ -40,9 +39,9 @@ public static void reportTimelineEvent(Reporter reporter, TimelineEntry timeline
.build());
}

public static void reportLogEvent(Reporter reporter, LogEntry logEntry) {
public static void reportLogEntry(Reporter reporter, LogEntry logEntry) {
reporter.report(Report.builder()
.withKey("DynawoTimelineEvent")
.withKey("dynawoLogEntry")
.withDefaultMessage("${message}")
.withValue("message", logEntry.message())
.withSeverity(logEntry.severity())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ private void reportTimeLine(Path workingDir) {
.resolve(DYNAWO_TIMELINE_FOLDER)
.resolve(DYNAFLOW_TIMELINE_FILE);
List<TimelineEntry> tl = new XmlTimeLineParser().parse(timelineFile);
tl.forEach(e -> CommonReports.reportTimelineEvent(dfReporter, e));
tl.forEach(e -> CommonReports.reportTimelineEntry(dfReporter, e));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public SecurityAnalysisReport after(Path workingDir, ExecutionReport report) thr
Path timelineDir = workingDir.resolve(DYNAWO_TIMELINE_FOLDER);
contingencies.forEach(c -> {
Reporter contingencyReporter = Reports.createDynaFlowTimelineReporter(reporter, c.getId());
getTimeline(timelineDir, c).forEach(e -> CommonReports.reportTimelineEvent(contingencyReporter, e));
getTimeline(timelineDir, c).forEach(e -> CommonReports.reportTimelineEntry(contingencyReporter, e));
});

return new SecurityAnalysisReport(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ private void setDynawoLog(Path outputsFolder) {
Path logFile = outputsFolder.resolve(LOGS_FOLDER).resolve(LOGS_FILENAME);
if (Files.exists(logFile)) {
Reporter logReporter = CommonReports.createDynawoLogReporter(reporter);
new CsvLogParser().parse(logFile).forEach(e -> CommonReports.reportLogEvent(logReporter, e));
new CsvLogParser().parse(logFile).forEach(e -> CommonReports.reportLogEntry(logReporter, e));
} else {
LOGGER.warn("Dynawo logs file not found");
}
Expand Down Expand Up @@ -257,7 +257,7 @@ private void setTimeline(Path outputsFolder) {
if (Files.exists(timelineFile)) {
Reporter timelineReporter = DynawaltzReports.createDynaWaltzTimelineReporter(reporter);
new CsvTimeLineParser().parse(timelineFile).forEach(e -> {
CommonReports.reportTimelineEvent(timelineReporter, e);
CommonReports.reportTimelineEntry(timelineReporter, e);
timeline.add(new TimelineEvent(e.time(), e.modelName(), e.message()));
});
} else {
Expand Down

0 comments on commit 8201ac5

Please sign in to comment.