You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by gg...@apache.org on 2022/01/09 15:44:46 UTC

[logging-log4j2] 01/02: Sort members.

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git

commit 0f6d9d130ed20b86d5978604b9047d97c0903b29
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jan 9 10:36:48 2022 -0500

    Sort members.
---
 .../apache/logging/log4j/spi/LoggerContext.java    | 130 ++++++++++-----------
 1 file changed, 65 insertions(+), 65 deletions(-)

diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/spi/LoggerContext.java b/log4j-api/src/main/java/org/apache/logging/log4j/spi/LoggerContext.java
index 955bb34..2dd94d8 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/spi/LoggerContext.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/spi/LoggerContext.java
@@ -30,6 +30,46 @@ public interface LoggerContext {
     Object getExternalContext();
 
     /**
+     * Returns an ExtendedLogger using the fully qualified name of the Class as the Logger name.
+     * @param cls The Class whose name should be used as the Logger name.
+     * @return The logger.
+     * @since 2.14.0
+     */
+    default ExtendedLogger getLogger(final Class<?> cls) {
+        final String canonicalName = cls.getCanonicalName();
+        return getLogger(canonicalName != null ? canonicalName : cls.getName());
+    }
+
+    /**
+     * Returns an ExtendedLogger using the fully qualified name of the Class as the Logger name.
+     * @param cls The Class whose name should be used as the Logger name.
+     * @param messageFactory The message factory is used only when creating a logger, subsequent use does not change the
+     *                       logger but will log a warning if mismatched.
+     * @return The logger.
+     * @since 2.14.0
+     */
+    default ExtendedLogger getLogger(final Class<?> cls, final MessageFactory messageFactory) {
+        final String canonicalName = cls.getCanonicalName();
+        return getLogger(canonicalName != null ? canonicalName : cls.getName(), messageFactory);
+    }
+
+    /**
+     * Returns an ExtendedLogger.
+     * @param name The name of the Logger to return.
+     * @return The logger with the specified name.
+     */
+    ExtendedLogger getLogger(String name);
+
+    /**
+     * Returns an ExtendedLogger.
+     * @param name The name of the Logger to return.
+     * @param messageFactory The message factory is used only when creating a logger, subsequent use does not change
+     *                       the logger but will log a warning if mismatched.
+     * @return The logger with the specified name.
+     */
+    ExtendedLogger getLogger(String name, MessageFactory messageFactory);
+
+    /**
      * Retrieve an object by its name.
      * @param key The object's key.
      * @return The Object that is associated with the key, if any.
@@ -40,6 +80,31 @@ public interface LoggerContext {
     }
 
     /**
+     * Detects if a Logger with the specified name exists.
+     * @param name The Logger name to search for.
+     * @return true if the Logger exists, false otherwise.
+     */
+    boolean hasLogger(String name);
+
+    /**
+     * Detects if a Logger with the specified name and MessageFactory type exists.
+     * @param name The Logger name to search for.
+     * @param messageFactoryClass The message factory class to search for.
+     * @return true if the Logger exists, false otherwise.
+     * @since 2.5
+     */
+    boolean hasLogger(String name, Class<? extends MessageFactory> messageFactoryClass);
+
+    /**
+     * Detects if a Logger with the specified name and MessageFactory exists.
+     * @param name The Logger name to search for.
+     * @param messageFactory The message factory to search for.
+     * @return true if the Logger exists, false otherwise.
+     * @since 2.5
+     */
+    boolean hasLogger(String name, MessageFactory messageFactory);
+
+    /**
      * Store an object into the LoggerContext by name for later use.
      * @param key The object's key.
      * @param value The object.
@@ -81,69 +146,4 @@ public interface LoggerContext {
     default boolean removeObject(final String key, final Object value) {
         return false;
     }
-
-    /**
-     * Returns an ExtendedLogger.
-     * @param name The name of the Logger to return.
-     * @return The logger with the specified name.
-     */
-    ExtendedLogger getLogger(String name);
-
-    /**
-     * Returns an ExtendedLogger using the fully qualified name of the Class as the Logger name.
-     * @param cls The Class whose name should be used as the Logger name.
-     * @return The logger.
-     * @since 2.14.0
-     */
-    default ExtendedLogger getLogger(final Class<?> cls) {
-        final String canonicalName = cls.getCanonicalName();
-        return getLogger(canonicalName != null ? canonicalName : cls.getName());
-    }
-
-    /**
-     * Returns an ExtendedLogger.
-     * @param name The name of the Logger to return.
-     * @param messageFactory The message factory is used only when creating a logger, subsequent use does not change
-     *                       the logger but will log a warning if mismatched.
-     * @return The logger with the specified name.
-     */
-    ExtendedLogger getLogger(String name, MessageFactory messageFactory);
-
-    /**
-     * Returns an ExtendedLogger using the fully qualified name of the Class as the Logger name.
-     * @param cls The Class whose name should be used as the Logger name.
-     * @param messageFactory The message factory is used only when creating a logger, subsequent use does not change the
-     *                       logger but will log a warning if mismatched.
-     * @return The logger.
-     * @since 2.14.0
-     */
-    default ExtendedLogger getLogger(final Class<?> cls, final MessageFactory messageFactory) {
-        final String canonicalName = cls.getCanonicalName();
-        return getLogger(canonicalName != null ? canonicalName : cls.getName(), messageFactory);
-    }
-
-    /**
-     * Detects if a Logger with the specified name exists.
-     * @param name The Logger name to search for.
-     * @return true if the Logger exists, false otherwise.
-     */
-    boolean hasLogger(String name);
-
-    /**
-     * Detects if a Logger with the specified name and MessageFactory exists.
-     * @param name The Logger name to search for.
-     * @param messageFactory The message factory to search for.
-     * @return true if the Logger exists, false otherwise.
-     * @since 2.5
-     */
-    boolean hasLogger(String name, MessageFactory messageFactory);
-
-    /**
-     * Detects if a Logger with the specified name and MessageFactory type exists.
-     * @param name The Logger name to search for.
-     * @param messageFactoryClass The message factory class to search for.
-     * @return true if the Logger exists, false otherwise.
-     * @since 2.5
-     */
-    boolean hasLogger(String name, Class<? extends MessageFactory> messageFactoryClass);
 }