Skip to content

Commit

Permalink
Revert "fixed serialization/deserialization of LogEntry"
Browse files Browse the repository at this point in the history
This reverts commit 939fd55.
  • Loading branch information
Yannic92 committed Aug 2, 2022
1 parent 367dec4 commit e727dad
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ public static LogEntry fromJson(final JsonObject jsonObject) {
final String message = jsonObject.getValueOrThrow(JsonFields.MESSAGE);
final String address = jsonObject.getValue(JsonFields.ADDRESS).orElse(null);
final EntityId entityId = jsonObject.getValue(JsonFields.ENTITY_ID)
.map(eId -> EntityId.of(
EntityType.of(jsonObject.getValue(JsonFields.ENTITY_TYPE).orElse("unknown")), eId))
.map(eId -> EntityId.of(EntityType.of("unknown"), eId))
.orElse(null);

return getBuilder(correlationId, timestamp, category, type, level, message, address, entityId)
Expand Down Expand Up @@ -179,7 +178,6 @@ public JsonObject toJson(final JsonSchemaVersion schemaVersion, final Predicate<
builder.set(JsonFields.ADDRESS, address);
}
if (null != entityId) {
builder.set(JsonFields.ENTITY_TYPE, entityId.getEntityType().toString());
builder.set(JsonFields.ENTITY_ID, entityId.toString());
}
return builder.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,15 +143,6 @@ final class JsonFields {
JsonFactory.newStringFieldDefinition("address", FieldType.REGULAR,
JsonSchemaVersion.V_2);

/**
* JSON field containing the entity type.
* @since 3.0.0
*/
public static final JsonFieldDefinition<String> ENTITY_TYPE =
JsonFactory.newStringFieldDefinition("entityType", FieldType.REGULAR,
JsonSchemaVersion.V_2);


/**
* JSON field containing the entity ID.
* @since 2.1.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ private static JsonObject getLogEntryJson() {
.set(LogEntry.JsonFields.LEVEL, LEVEL.getLevel())
.set(LogEntry.JsonFields.ADDRESS, ADDRESS)
.set(LogEntry.JsonFields.ENTITY_ID, THING_ID.toString())
.set(LogEntry.JsonFields.ENTITY_TYPE, THING_ID.getEntityType().toString())
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,6 @@ public static final class Json {
.set(LogEntry.JsonFields.LEVEL, LEVEL.getLevel())
.set(LogEntry.JsonFields.ADDRESS, ADDRESS)
.set(LogEntry.JsonFields.ENTITY_ID, THING_ID.toString())
.set(LogEntry.JsonFields.ENTITY_TYPE, THING_ID.getEntityType().toString())
.build();
public static final JsonObject ENTRY_2_JSON = JsonFactory.newObjectBuilder()
.set(LogEntry.JsonFields.CORRELATION_ID, CORRELATION_ID)
Expand All @@ -271,7 +270,6 @@ public static final class Json {
.set(LogEntry.JsonFields.LEVEL, LEVEL.getLevel())
.set(LogEntry.JsonFields.ADDRESS, ADDRESS)
.set(LogEntry.JsonFields.ENTITY_ID, THING_ID.toString())
.set(LogEntry.JsonFields.ENTITY_TYPE, THING_ID.getEntityType().toString())
.build();

public static final JsonArray ENTRIES_JSON = JsonFactory.newArrayBuilder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ final class FluentPublishingConnectionLogger
private static final String TAG_TYPE = toTag(LogEntry.JsonFields.TYPE);
private static final String TAG_CORRELATION_ID = toTag(LogEntry.JsonFields.CORRELATION_ID);
private static final String TAG_ADDRESS = toTag(LogEntry.JsonFields.ADDRESS);
private static final String TAG_ENTITY_TYPE = toTag(LogEntry.JsonFields.ENTITY_TYPE);
private static final String TAG_ENTITY_TYPE = "entityType";
private static final String TAG_ENTITY_ID = toTag(LogEntry.JsonFields.ENTITY_ID);
private static final String TAG_MESSAGE = toTag(LogEntry.JsonFields.MESSAGE);
private static final String TAG_INSTANCE_ID = "instanceId";
Expand Down

0 comments on commit e727dad

Please sign in to comment.