MCPcopy
hub / github.com/qos-ch/slf4j / Logger

Interface Logger

slf4j-api/src/main/java/org/slf4j/Logger.java:84–881  ·  view source on GitHub ↗

The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that logging takes place through concrete implementations of this interface. Typical usage pattern: import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class Wombat { <span style=

Source from the content-addressed store, hash-verified

82 * @author Ceki G&uuml;lc&uuml;
83 */
84public interface Logger {
85
86 /**
87 * Case-insensitive String constant used to retrieve the name of the root logger.
88 *
89 * @since 1.3
90 */
91 final public String ROOT_LOGGER_NAME = "ROOT";
92
93 /**
94 * Return the name of this <code>Logger</code> instance.
95 * @return name of this logger instance
96 */
97 public String getName();
98
99 /**
100 * <p>Make a new {@link LoggingEventBuilder} instance as appropriate for this logger implementation.
101 * This default implementation always returns a new instance of {@link DefaultLoggingEventBuilder}.</p>
102 * <p></p>
103 * <p>This method is intended to be used by logging systems implementing the SLF4J API and <b>not</b>
104 * by end users.</p>
105 * <p></p>
106 * <p>Also note that a {@link LoggingEventBuilder} instance should be built for all levels,
107 * independently of the level argument. In other words, this method is an <b>unconditional</b>
108 * constructor for the {@link LoggingEventBuilder} appropriate for this logger implementation.</p>
109 * <p></p>
110 * @param level desired level for the event builder
111 * @return a new {@link LoggingEventBuilder} instance as appropriate for <b>this</b> logger
112 * @since 2.0
113 */
114 default public LoggingEventBuilder makeLoggingEventBuilder(Level level) {
115 return new DefaultLoggingEventBuilder(this, level);
116 }
117
118 /**
119 * Make a new {@link LoggingEventBuilder} instance as appropriate for this logger and the
120 * desired {@link Level} passed as parameter. If this Logger is disabled for the given Level, then
121 * a {@link NOPLoggingEventBuilder} is returned.
122 *
123 *
124 * @param level desired level for the event builder
125 * @return a new {@link LoggingEventBuilder} instance as appropriate for this logger
126 * @since 2.0
127 */
128 @CheckReturnValue
129 default public LoggingEventBuilder atLevel(Level level) {
130 if (isEnabledForLevel(level)) {
131 return makeLoggingEventBuilder(level);
132 } else {
133 return NOPLoggingEventBuilder.singleton();
134 }
135 }
136
137
138
139 /**
140 * Returns whether this Logger is enabled for a given {@link Level}.
141 *

Callers 111

testPassIfMatchMethod · 0.95
getLoggerMethod · 0.95
commonTestThreadIdMethod · 0.65
createLoggerMethod · 0.65
performLogMethod · 0.65
atLevelMethod · 0.65
smokxceMethod · 0.95

Implementers 8

SubstituteLoggerslf4j-api/src/main/java/org/slf4j/help
LocLoggerslf4j-ext/src/main/java/org/slf4j/cal1
LoggerWrapperslf4j-ext/src/main/java/org/slf4j/ext/
XLoggerslf4j-ext/src/main/java/org/slf4j/ext/
NOPLoggerslf4j-api/src/main/java/org/slf4j/help
MarkerIgnoringBaseslf4j-api/src/main/java/org/slf4j/help
NamedLoggerBaseslf4j-api/src/main/java/org/slf4j/help
AbstractLoggerslf4j-api/src/main/java/org/slf4j/help

Calls

no outgoing calls

Tested by

no test coverage detected