ppkarwasz commented on code in PR #3338:
URL: https://github.com/apache/logging-log4j2/pull/3338#discussion_r1898975767


##########
log4j-core/src/main/java/org/apache/logging/log4j/core/util/internal/instant/InstantPatternDynamicFormatter.java:
##########
@@ -641,32 +411,39 @@ public TimeZone getTimeZone() {
         }
     }
 
-    abstract static class PatternSequence {
+    /**
+     * Creates an {@link InstantPatternFormatter}.
+     */
+    abstract static class PatternFormatterFactory {
 
         final String pattern;
 
         final ChronoUnit precision;
 
         @SuppressWarnings("ReturnValueIgnored")
-        PatternSequence(final String pattern, final ChronoUnit precision) {
+        PatternFormatterFactory(final String pattern, final ChronoUnit 
precision) {
             DateTimeFormatter.ofPattern(pattern); // Validate the pattern
             this.pattern = pattern;
             this.precision = precision;
         }
 
-        InstantPatternFormatter createFormatter(final Locale locale, final 
TimeZone timeZone) {
-            final DateTimeFormatter dateTimeFormatter =
-                    DateTimeFormatter.ofPattern(pattern, 
locale).withZone(timeZone.toZoneId());
-            return new AbstractFormatter(pattern, locale, timeZone, precision) 
{
-                @Override
-                public void formatTo(final StringBuilder buffer, final Instant 
instant) {
-                    final TemporalAccessor instantAccessor = 
toTemporalAccessor(instant);
-                    dateTimeFormatter.formatTo(instantAccessor, buffer);
-                }
-            };
+        abstract InstantPatternFormatter createFormatter(final Locale locale, 
final TimeZone timeZone);
+
+        /**
+         * Tries to merge two factories.
+         *
+         * @param other A pattern formatter factory.
+         * @param thresholdPrecision The time interval during which the 
instant formatters created by this factory will
+         *                           be used.

Review Comment:
   Changes in 
https://github.com/apache/logging-log4j2/pull/3338/commits/7879316ab6c81fdb7cb676ac3dfdeed906a832fe



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to