Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
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 (309)
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/helpers/NormalizedParameters.java
package org.slf4j.helpers; import org.slf4j.event.LoggingEvent; /** * Holds normalized call parameters. * * Includes utility methods such as {@link #normalize(String, Object[], Throwable)} to help the normalization of parameters. * * @author ceki * @since 2.0 */ public class NormalizedParameters { final String message; final Object[] arguments; final Throwable throwable; public NormalizedParameters(String message, Object[] arguments, Throwable throwable) { this.message = message; this.arguments = arguments; this.throwable = throwable; } public NormalizedParameters(String message, Object[] arguments) { this(message, arguments, null); } public String getMessage() { return message; } public Object[] getArguments() { return arguments; } public Throwable getThrowable() { return throwable; } /** * Helper method to determine if an {@link Object} array contains a * {@link Throwable} as last element * * @param argArray The arguments off which we want to know if it contains a * {@link Throwable} as last element * @return if the last {@link Object} in argArray is a {@link Throwable} this * method will return it, otherwise it returns null */ public static Throwable getThrowableCandidate(final Object[] argArray) { if (argArray == null || argArray.length == 0) { return null; } final Object lastEntry = argArray[argArray.length - 1]; if (lastEntry instanceof Throwable) { return (Throwable) lastEntry; } return null; } /** * Helper method to get all but the last element of an array * * @param argArray The arguments from which we want to remove the last element * * @return a copy of the array without the last element */ public static Object[] trimmedCopy(final Object[] argArray) { if (argArray == null || argArray.length == 0) { throw new IllegalStateException("non-sensical empty or null argument array"); } final int trimmedLen = argArray.length - 1; Object[] trimmed = new Object[trimmedLen]; if (trimmedLen > 0) { System.arraycopy(argArray, 0, trimmed, 0, trimmedLen); } return trimmed; } /** * This method serves to normalize logging call invocation parameters. * * More specifically, if a throwable argument is not supplied directly, it * attempts to extract it from the argument array. */ public static NormalizedParameters normalize(String msg, Object[] arguments, Throwable t) { if (t != null) { return new NormalizedParameters(msg, arguments, t); } if (arguments == null || arguments.length == 0) { return new NormalizedParameters(msg, arguments, t); } Throwable throwableCandidate = NormalizedParameters.getThrowableCandidate(arguments); if (throwableCandidate != null) { Object[] trimmedArguments = MessageFormatter.trimmedCopy(arguments); return new NormalizedParameters(msg, trimmedArguments, throwableCandidate); } else { return new NormalizedParameters(msg, arguments); } } public static NormalizedParameters normalize(LoggingEvent event) { return normalize(event.getMessage(), event.getArgumentArray(), event.getThrowable()); } }
⏎ org/slf4j/helpers/NormalizedParameters.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, 30629👍, 2💬
Popular Posts:
maven-core-3.8.6.jar is the JAR file for Apache Maven 3.8.6 Core module. Apache Maven is a software ...
JDK 11 java.security.jgss.jmod is the JMOD file for JDK 11 Security JGSS (Java Generic Security Serv...
JDK 11 jdk.localedata.jmod is the JMOD file for JDK 11 Localedata module. JDK 11 Locale Data module ...
Provides support for the runtime platform, core utility methods and the extension registry. JAR File...
How to download and install javamail-1_2.zip? The JavaMail API is a set of abstract APIs that model ...