Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
SLF4J API Source Code
SLF4J API is a simple API that allows to plug in any desired logging library
at deployment time.
Here is the source code for SLF4J API 2.0.4. You can download its pre-compiled version slf4j-api-2.0.4.jar at SLF4J Download Website.
✍: FYIcenter.com
⏎ org/slf4j/event/DefaultLoggingEvent.java
package org.slf4j.event;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.Marker;
/**
* A default implementation of {@link LoggingEvent}.
*
* @author Ceki Gülcü
*
* @since 2.0.0
*/
public class DefaultLoggingEvent implements LoggingEvent {
Logger logger;
Level level;
String message;
List<Marker> markers;
List<Object> arguments;
List<KeyValuePair> keyValuePairs;
Throwable throwable;
String threadName;
long timeStamp;
String callerBoundary;
public DefaultLoggingEvent(Level level, Logger logger) {
this.logger = logger;
this.level = level;
}
public void addMarker(Marker marker) {
if (markers == null) {
markers = new ArrayList<>(2);
}
markers.add(marker);
}
@Override
public List<Marker> getMarkers() {
return markers;
}
public void addArgument(Object p) {
getNonNullArguments().add(p);
}
public void addArguments(Object... args) {
getNonNullArguments().addAll(Arrays.asList(args));
}
private List<Object> getNonNullArguments() {
if (arguments == null) {
arguments = new ArrayList<>(3);
}
return arguments;
}
@Override
public List<Object> getArguments() {
return arguments;
}
@Override
public Object[] getArgumentArray() {
if (arguments == null)
return null;
return arguments.toArray();
}
public void addKeyValue(String key, Object value) {
getNonnullKeyValuePairs().add(new KeyValuePair(key, value));
}
private List<KeyValuePair> getNonnullKeyValuePairs() {
if (keyValuePairs == null) {
keyValuePairs = new ArrayList<>(4);
}
return keyValuePairs;
}
@Override
public List<KeyValuePair> getKeyValuePairs() {
return keyValuePairs;
}
public void setThrowable(Throwable cause) {
this.throwable = cause;
}
@Override
public Level getLevel() {
return level;
}
@Override
public String getLoggerName() {
return logger.getName();
}
@Override
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
@Override
public Throwable getThrowable() {
return throwable;
}
public String getThreadName() {
return threadName;
}
public long getTimeStamp() {
return timeStamp;
}
public void setTimeStamp(long timeStamp) {
this.timeStamp = timeStamp;
}
public void setCallerBoundary(String fqcn) {
this.callerBoundary = fqcn;
}
public String getCallerBoundary() {
return callerBoundary;
}
}
⏎ org/slf4j/event/DefaultLoggingEvent.java
Or download all of them as a single archive file:
File name: slf4j-api-2.0.4-sources.jar File size: 70304 bytes Release date: 2022-11-17 Download
⇒ Source Code for SLF4J Simple Logging
⇐ Downloading SLF4J Components
2020-02-13, ≈50🔥, 2💬
Popular Posts:
Jackson is "the Java JSON library" or "the best JSON parser for Java". Or simply as "JSON for Java"....
The Java Naming and Directory Interface (JNDI) is part of the Java platform, providing applications ...
Apache Commons CLI Source Code Files are provided in the source package file commons-cli-1.5.0-sourc. ..
commons-collections4-4.4 -sources.jaris the source JAR file for Apache Commons Collections 4.2, whic...
Jackson is "the Java JSON library" or "the best JSON parser for Java". Or simply as "JSON for Java"....