diff --git a/monologue/src/generate/java/DataLogger.java.jinja b/monologue/src/generate/java/DataLogger.java.jinja index f26b96c..953167c 100644 --- a/monologue/src/generate/java/DataLogger.java.jinja +++ b/monologue/src/generate/java/DataLogger.java.jinja @@ -77,8 +77,7 @@ class DataLogger extends GenericLogger { level, consumer ); -{%else%} -{%if t.java.IsArray == true%} +{%elif t.java.IsArray == true%} if (this.isLazy()) { consumer = new LongConsumer() { private {{t.java.ValueType}} lastValue = new {{t.java.ValueType}} {}; @@ -104,6 +103,11 @@ class DataLogger extends GenericLogger { } }; } + addField( + entryName, + level, + consumer + ); {%else%} if (this.isLazy()) { consumer = new LongConsumer() { @@ -127,7 +131,6 @@ class DataLogger extends GenericLogger { entry.append(value, timestamp); }; } -{%endif%} addField( entryName, diff --git a/monologue/src/generate/java/NTLogger.java.jinja b/monologue/src/generate/java/NTLogger.java.jinja index 98f3378..87634d8 100644 --- a/monologue/src/generate/java/NTLogger.java.jinja +++ b/monologue/src/generate/java/NTLogger.java.jinja @@ -123,8 +123,7 @@ class NTLogger extends GenericLogger { }, entry::unpublish ); -{%else%} -{%if t.java.IsArray == true%} +{%elif t.java.IsArray == true%} if (this.isLazy()) { consumer = new LongConsumer() { private {{t.java.ValueType}} lastValue = new {{t.java.ValueType}} {}; @@ -150,6 +149,18 @@ class NTLogger extends GenericLogger { } }; } + + addField( + entryName, + level, + consumer, + () -> { + var value = valueSupplier.get(); + if (value == null) { return;} + entry.set(value); + }, + entry::unpublish + ); {%else%} if (this.isLazy()) { consumer = new LongConsumer() { @@ -172,7 +183,6 @@ class NTLogger extends GenericLogger { entry.set(value, timestamp); }; } -{%endif%} addField( entryName,