Skip to content

Commit

Permalink
feat: improve general log texts
Browse files Browse the repository at this point in the history
With this change we general text surrounding the logging has been improved. This is done to give the users some more detailed information about what could be wrong and where to look to fix it.
  • Loading branch information
remcowesterhoud committed Feb 24, 2022
1 parent 848d9a2 commit f87d84a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void afterEach(final ExtensionContext extensionContext) {
public void testFailed(final ExtensionContext extensionContext, final Throwable cause) {
final Object engineContent = getStore(extensionContext.getParent().get()).get(KEY_ZEEBE_ENGINE);
final ContainerizedEngine engine = (ContainerizedEngine) engineContent;
LOG.error("===== Test failed! Printing records from the stream:");
LOG.error("===== Test failed!");
RecordStream.of(engine.getRecordStreamSource()).print(true);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public void testFailed(final ExtensionContext extensionContext, final Throwable
final Object engineContent = getStore(extensionContext).get(KEY_ZEEBE_ENGINE);
final InMemoryEngine engine = (InMemoryEngine) engineContent;

LOG.error("===== Test failed! Printing records from the stream:");
LOG.error("===== Test failed!");
RecordStream.of(engine.getRecordStreamSource()).print(true);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,18 @@ private void logIncidents(final StringBuilder stringBuilder) {
stringBuilder
.append(System.lineSeparator())
.append(System.lineSeparator())
.append("Incidents occurred:")
.append("Unresolved incident(s) exist at the end of this test")
.append(System.lineSeparator());
createIncidents.forEach(
record -> {
if (!resolvedIncidents.contains(record.getKey())) {
stringBuilder.append(summarizeIncident(record)).append(System.lineSeparator());
}
});
stringBuilder.append(System.lineSeparator());
stringBuilder.append(System.lineSeparator())
.append("If you did not expect any incidents to occur, then we recommend investigating"
+ "these. These incidents may indicate what went wrong in your test case")
.append(System.lineSeparator());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ public RecordStreamLogger(final RecordStreamSource recordStreamSource) {
}

public void log() {
final StringBuilder stringBuilder = new StringBuilder();
final StringBuilder stringBuilder = new StringBuilder().append(System.lineSeparator());
logRecords(stringBuilder);
}

private void logRecords(final StringBuilder stringBuilder) {
stringBuilder.append("Records:");
stringBuilder.append("The following records have been recorded during this test:");
recordStream
.records()
.forEach(
Expand Down

0 comments on commit f87d84a

Please sign in to comment.