diff options
Diffstat (limited to 'slf4j-android/src')
7 files changed, 0 insertions, 971 deletions
diff --git a/slf4j-android/src/main/java/org/slf4j/impl/AndroidLoggerAdapter.java b/slf4j-android/src/main/java/org/slf4j/impl/AndroidLoggerAdapter.java deleted file mode 100755 index c13a7ce8..00000000 --- a/slf4j-android/src/main/java/org/slf4j/impl/AndroidLoggerAdapter.java +++ /dev/null @@ -1,553 +0,0 @@ -/* - * Copyright (c) 2004-2013 QOS.ch - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - */ -package org.slf4j.impl; - -import android.util.Log; -import org.slf4j.helpers.FormattingTuple; -import org.slf4j.helpers.MarkerIgnoringBase; -import org.slf4j.helpers.MessageFormatter; - -/** - * <p>A simple implementation that delegates all log requests to the Google Android - * logging facilities. Note that this logger does not support {@link org.slf4j.Marker}. - * Methods taking marker data as parameter simply invoke the eponymous method - * without the Marker argument, discarding any marker data in the process.</p> - * - * <p>The logging levels specified for SLF4J can be almost directly mapped to - * the levels that exist in the Google Android platform. The following table - * shows the mapping implemented by this logger.</p> - * - * <table border="1"> - * <tr><th><b>SLF4J<b></th><th><b>Android</b></th></tr> - * <tr><td>TRACE</td><td>{@link android.util.Log#VERBOSE}</td></tr> - * <tr><td>DEBUG</td><td>{@link android.util.Log#DEBUG}</td></tr> - * <tr><td>INFO</td><td>{@link android.util.Log#INFO}</td></tr> - * <tr><td>WARN</td><td>{@link android.util.Log#WARN}</td></tr> - * <tr><td>ERROR</td><td>{@link android.util.Log#ERROR}</td></tr> - * </table> - * - * <p>Use loggers as usual: - * <ul> - * <li> - * Declare a logger<br/> - * <code>private static final Logger logger = LoggerFactory.getLogger(MyClass.class);</code> - * </li> - * <li> - * Invoke logging methods, e.g.,<br/> - * <code>logger.debug("Some log message. Details: {}", someObject);</code><br/> - * <code>logger.debug("Some log message with varargs. Details: {}, {}, {}", someObject1, someObject2, someObject3);</code> - * </li> - * </ul> - * </p> - * - * <p>Logger instances created using the LoggerFactory are named either according to the name - * or the fully qualified class name of the class given as a parameter. - * Each logger name will be used as the log message tag on the Android platform. - * However, tag names cannot be longer than 23 characters so if logger name exceeds this limit then - * it will be truncated by the LoggerFactory. The following examples illustrate this. - * <table border="1"> - * <tr><th><b>Original Name<b></th><th><b>Truncated Name</b></th></tr> - * <tr><td>org.example.myproject.mypackage.MyClass</td><td>o*.e*.m*.m*.MyClass</td></tr> - * <tr><td>o.e.myproject.mypackage.MyClass</td><td>o.e.m*.m*.MyClass</td></tr> - * <tr><td>org.example.ThisNameIsWayTooLongAndWillBeTruncated</td><td>*LongAndWillBeTruncated</td></tr> - * <tr><td>ThisNameIsWayTooLongAndWillBeTruncated</td><td>*LongAndWillBeTruncated</td></tr> - * </table> - * </p> - * - * @author Andrey Korzhevskiy <a.korzhevskiy@gmail.com> - */ -class AndroidLoggerAdapter extends MarkerIgnoringBase { - private static final long serialVersionUID = -1227274521521287937L; - - - /** - * Package access allows only {@link AndroidLoggerFactory} to instantiate - * SimpleLogger instances. - */ - AndroidLoggerAdapter(String tag) { - this.name = tag; - } - - /** - * Is this logger instance enabled for the VERBOSE level? - * - * @return True if this Logger is enabled for level VERBOSE, false otherwise. - */ - public boolean isTraceEnabled() { - return isLoggable(Log.VERBOSE); - } - - /** - * Log a message object at level VERBOSE. - * - * @param msg - * - the message object to be logged - */ - public void trace(String msg) { - log(Log.VERBOSE, msg, null); - } - - /** - * Log a message at level VERBOSE according to the specified format and - * argument. - * - * <p> - * This form avoids superfluous object creation when the logger is disabled - * for level VERBOSE. - * </p> - * - * @param format - * the format string - * @param arg - * the argument - */ - public void trace(String format, Object arg) { - formatAndLog(Log.VERBOSE, format, arg); - } - - /** - * Log a message at level VERBOSE according to the specified format and - * arguments. - * - * <p> - * This form avoids superfluous object creation when the logger is disabled - * for the VERBOSE level. - * </p> - * - * @param format - * the format string - * @param arg1 - * the first argument - * @param arg2 - * the second argument - */ - public void trace(String format, Object arg1, Object arg2) { - formatAndLog(Log.VERBOSE, format, arg1, arg2); - } - - /** - * Log a message at level VERBOSE according to the specified format and - * arguments. - * - * <p> - * This form avoids superfluous object creation when the logger is disabled - * for the VERBOSE level. - * </p> - * - * @param format - * the format string - * @param argArray - * an array of arguments - */ - public void trace(String format, Object... argArray) { - formatAndLog(Log.VERBOSE, format, argArray); - } - - /** - * Log an exception (throwable) at level VERBOSE with an accompanying message. - * - * @param msg - * the message accompanying the exception - * @param t - * the exception (throwable) to log - */ - public void trace(String msg, Throwable t) { - log(Log.VERBOSE, msg, t); - } - - /** - * Is this logger instance enabled for the DEBUG level? - * - * @return True if this Logger is enabled for level DEBUG, false otherwise. - */ - public boolean isDebugEnabled() { - return isLoggable(Log.DEBUG); - } - - /** - * Log a message object at level DEBUG. - * - * @param msg - * - the message object to be logged - */ - public void debug(String msg) { - log(Log.DEBUG, msg, null); - } - - /** - * Log a message at level DEBUG according to the specified format and argument. - * - * <p> - * This form avoids superfluous object creation when the logger is disabled - * for level DEBUG. - * </p> - * - * @param format - * the format string - * @param arg - * the argument - */ - public void debug(String format, Object arg) { - formatAndLog(Log.DEBUG, format, arg); - } - - /** - * Log a message at level DEBUG according to the specified format and - * arguments. - * - * <p> - * This form avoids superfluous object creation when the logger is disabled - * for the DEBUG level. - * </p> - * - * @param format - * the format string - * @param arg1 - * the first argument - * @param arg2 - * the second argument - */ - public void debug(String format, Object arg1, Object arg2) { - formatAndLog(Log.DEBUG, format, arg1, arg2); - } - - /** - * Log a message at level DEBUG according to the specified format and - * arguments. - * - * <p> - * This form avoids superfluous object creation when the logger is disabled - * for the DEBUG level. - * </p> - * - * @param format - * the format string - * @param argArray - * an array of arguments - */ - public void debug(String format, Object... argArray) { - formatAndLog(Log.DEBUG, format, argArray); - } - - /** - * Log an exception (throwable) at level DEBUG with an accompanying message. - * - * @param msg - * the message accompanying the exception - * @param t - * the exception (throwable) to log - */ - public void debug(String msg, Throwable t) { - log(Log.VERBOSE, msg, t); - } - - /** - * Is this logger instance enabled for the INFO level? - * - * @return True if this Logger is enabled for the INFO level, false otherwise. - */ - public boolean isInfoEnabled() { - return isLoggable(Log.INFO); - } - - /** - * Log a message object at the INFO level. - * - * @param msg - * - the message object to be logged - */ - public void info(String msg) { - log(Log.INFO, msg, null); - } - - /** - * Log a message at level INFO according to the specified format and argument. - * - * <p> - * This form avoids superfluous object creation when the logger is disabled - * for the INFO level. - * </p> - * - * @param format - * the format string - * @param arg - * the argument - */ - public void info(String format, Object arg) { - formatAndLog(Log.INFO, format, arg); - } - - /** - * Log a message at the INFO level according to the specified format and - * arguments. - * - * <p> - * This form avoids superfluous object creation when the logger is disabled - * for the INFO level. - * </p> - * - * @param format - * the format string - * @param arg1 - * the first argument - * @param arg2 - * the second argument - */ - public void info(String format, Object arg1, Object arg2) { - formatAndLog(Log.INFO, format, arg1, arg2); - } - - /** - * Log a message at level INFO according to the specified format and - * arguments. - * - * <p> - * This form avoids superfluous object creation when the logger is disabled - * for the INFO level. - * </p> - * - * @param format - * the format string - * @param argArray - * an array of arguments - */ - public void info(String format, Object... argArray) { - formatAndLog(Log.INFO, format, argArray); - } - - /** - * Log an exception (throwable) at the INFO level with an accompanying - * message. - * - * @param msg - * the message accompanying the exception - * @param t - * the exception (throwable) to log - */ - public void info(String msg, Throwable t) { - log(Log.INFO, msg, t); - } - - /** - * Is this logger instance enabled for the WARN level? - * - * @return True if this Logger is enabled for the WARN level, false - * otherwise. - */ - public boolean isWarnEnabled() { - return isLoggable(Log.WARN); - } - - /** - * Log a message object at the WARN level. - * - * @param msg - * - the message object to be logged - */ - public void warn(String msg) { - log(Log.WARN, msg, null); - } - - /** - * Log a message at the WARN level according to the specified format and - * argument. - * - * <p> - * This form avoids superfluous object creation when the logger is disabled - * for the WARN level. - * </p> - * - * @param format - * the format string - * @param arg - * the argument - */ - public void warn(String format, Object arg) { - formatAndLog(Log.WARN, format, arg); - } - - /** - * Log a message at the WARN level according to the specified format and - * arguments. - * - * <p> - * This form avoids superfluous object creation when the logger is disabled - * for the WARN level. - * </p> - * - * @param format - * the format string - * @param arg1 - * the first argument - * @param arg2 - * the second argument - */ - public void warn(String format, Object arg1, Object arg2) { - formatAndLog(Log.WARN, format, arg1, arg2); - } - - /** - * Log a message at level WARN according to the specified format and - * arguments. - * - * <p> - * This form avoids superfluous object creation when the logger is disabled - * for the WARN level. - * </p> - * - * @param format - * the format string - * @param argArray - * an array of arguments - */ - public void warn(String format, Object... argArray) { - formatAndLog(Log.WARN, format, argArray); - } - - /** - * Log an exception (throwable) at the WARN level with an accompanying - * message. - * - * @param msg - * the message accompanying the exception - * @param t - * the exception (throwable) to log - */ - public void warn(String msg, Throwable t) { - log(Log.WARN, msg, t); - } - - /** - * Is this logger instance enabled for level ERROR? - * - * @return True if this Logger is enabled for level ERROR, false otherwise. - */ - public boolean isErrorEnabled() { - return isLoggable(Log.ERROR); - } - - /** - * Log a message object at the ERROR level. - * - * @param msg - * - the message object to be logged - */ - public void error(String msg) { - log(Log.ERROR, msg, null); - } - - /** - * Log a message at the ERROR level according to the specified format and - * argument. - * - * <p> - * This form avoids superfluous object creation when the logger is disabled - * for the ERROR level. - * </p> - * - * @param format - * the format string - * @param arg - * the argument - */ - public void error(String format, Object arg) { - formatAndLog(Log.ERROR, format, arg); - } - - /** - * Log a message at the ERROR level according to the specified format and - * arguments. - * - * <p> - * This form avoids superfluous object creation when the logger is disabled - * for the ERROR level. - * </p> - * - * @param format - * the format string - * @param arg1 - * the first argument - * @param arg2 - * the second argument - */ - public void error(String format, Object arg1, Object arg2) { - formatAndLog(Log.ERROR, format, arg1, arg2); - } - - /** - * Log a message at level ERROR according to the specified format and - * arguments. - * - * <p> - * This form avoids superfluous object creation when the logger is disabled - * for the ERROR level. - * </p> - * - * @param format - * the format string - * @param argArray - * an array of arguments - */ - public void error(String format, Object... argArray) { - formatAndLog(Log.ERROR, format, argArray); - } - - /** - * Log an exception (throwable) at the ERROR level with an accompanying - * message. - * - * @param msg - * the message accompanying the exception - * @param t - * the exception (throwable) to log - */ - public void error(String msg, Throwable t) { - log(Log.ERROR, msg, t); - } - - private void formatAndLog(int priority, String format, Object... argArray) { - if (isLoggable(priority)) { - FormattingTuple ft = MessageFormatter.arrayFormat(format, argArray); - _log(priority, ft.getMessage(), ft.getThrowable()); - } - } - - private void log(int priority, String message, Throwable throwable) { - if (isLoggable(priority)) { - _log(priority, message, throwable); - } - } - - private boolean isLoggable(int priority) { - return Log.isLoggable(name, priority); - } - - private void _log(int priority, String message, Throwable throwable) { - if (throwable != null) { - message += '\n' + Log.getStackTraceString(throwable); - } - Log.println(priority, name, message); - } -}
\ No newline at end of file diff --git a/slf4j-android/src/main/java/org/slf4j/impl/AndroidLoggerFactory.java b/slf4j-android/src/main/java/org/slf4j/impl/AndroidLoggerFactory.java deleted file mode 100755 index f27ff551..00000000 --- a/slf4j-android/src/main/java/org/slf4j/impl/AndroidLoggerFactory.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (c) 2004-2013 QOS.ch - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - */ -package org.slf4j.impl; - -import org.slf4j.ILoggerFactory; -import org.slf4j.Logger; - -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; - -/** - * AndroidLoggerFactory is an implementation of {@link ILoggerFactory} returning - * the appropriately named {@link AndroidLoggerFactory} instance. - * - * @author Andrey Korzhevskiy <a.korzhevskiy@gmail.com> - */ -class AndroidLoggerFactory implements ILoggerFactory { - static final String ANONYMOUS_TAG = "null"; - static final int TAG_MAX_LENGTH = 23; - - private final ConcurrentMap<String, Logger> loggerMap = new ConcurrentHashMap<String, Logger>(); - - /** - * Return an appropriate {@link AndroidLoggerAdapter} instance by name. - */ - public Logger getLogger(String name) { - String tag = loggerNameToTag(name); - Logger logger = loggerMap.get(tag); - if (logger == null) { - Logger newInstance = new AndroidLoggerAdapter(tag); - Logger oldInstance = loggerMap.putIfAbsent(tag, newInstance); - logger = oldInstance == null ? newInstance : oldInstance; - } - return logger; - } - - /** - * Tag names cannot be longer than {@value #TAG_MAX_LENGTH} characters on Android platform. - * - * Returns the short logger tag (up to {@value #TAG_MAX_LENGTH} characters) for the given logger name. - * Traditionally loggers are named by fully-qualified Java classes; this - * method attempts to return a concise identifying part of such names. - * - * See also: - * android/system/core/include/cutils/property.h - * android/frameworks/base/core/jni/android_util_Log.cpp - * dalvik.system.DalvikLogging - * - */ - static String loggerNameToTag(String loggerName) { - // Anonymous logger - if (loggerName == null) { - return ANONYMOUS_TAG; - } - - int length = loggerName.length(); - if (length <= TAG_MAX_LENGTH) { - return loggerName; - } - - int tagLength = 0; - int lastTokenIndex = 0; - int lastPeriodIndex; - StringBuilder tagName = new StringBuilder(TAG_MAX_LENGTH + 3); - while ((lastPeriodIndex = loggerName.indexOf('.', lastTokenIndex)) != -1) { - tagName.append(loggerName.charAt(lastTokenIndex)); - // token of one character appended as is otherwise truncate it to one character - int tokenLength = lastPeriodIndex - lastTokenIndex; - if (tokenLength > 1) { - tagName.append('*'); - } - tagName.append('.'); - lastTokenIndex = lastPeriodIndex + 1; - - // check if name is already too long - tagLength = tagName.length(); - if (tagLength > TAG_MAX_LENGTH) { - return getSimpleName(loggerName); - } - } - - // Either we had no useful dot location at all - // or last token would exceed TAG_MAX_LENGTH - int tokenLength = length - lastTokenIndex; - if (tagLength == 0 || (tagLength + tokenLength) > TAG_MAX_LENGTH) { - return getSimpleName(loggerName); - } - - // last token (usually class name) appended as is - tagName.append(loggerName, lastTokenIndex, length); - return tagName.toString(); - } - - private static String getSimpleName(String loggerName) { - // Take leading part and append '*' to indicate that it was truncated - int length = loggerName.length(); - int lastPeriodIndex = loggerName.lastIndexOf('.'); - return lastPeriodIndex != -1 && length - (lastPeriodIndex + 1) <= TAG_MAX_LENGTH - ? loggerName.substring(lastPeriodIndex + 1) - : '*' + loggerName.substring(length - TAG_MAX_LENGTH + 1); - } -}
\ No newline at end of file diff --git a/slf4j-android/src/main/java/org/slf4j/impl/StaticLoggerBinder.java b/slf4j-android/src/main/java/org/slf4j/impl/StaticLoggerBinder.java deleted file mode 100644 index 7817d9bf..00000000 --- a/slf4j-android/src/main/java/org/slf4j/impl/StaticLoggerBinder.java +++ /dev/null @@ -1,81 +0,0 @@ -/** - * Copyright (c) 2004-2013 QOS.ch - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - */ -package org.slf4j.impl; - -import org.slf4j.ILoggerFactory; -import org.slf4j.LoggerFactory; -import org.slf4j.spi.LoggerFactoryBinder; - -/** - * The binding of {@link LoggerFactory} class with an actual instance of - * {@link ILoggerFactory} is performed using information returned by this class. - * - * @author Ceki Gülcü - * @author Andrey Korzhevskiy <a.korzhevskiy@gmail.com> - */ -public class StaticLoggerBinder implements LoggerFactoryBinder { - - /** - * The unique instance of this class. - */ - private static final StaticLoggerBinder SINGLETON = new StaticLoggerBinder(); - - /** - * Return the singleton of this class. - * - * @return the StaticLoggerBinder singleton - */ - public static StaticLoggerBinder getSingleton() { - return SINGLETON; - } - - /** - * Declare the version of the SLF4J API this implementation is compiled against. - * The value of this field is usually modified with each release. - */ - // to avoid constant folding by the compiler, this field must *not* be final - public static String REQUESTED_API_VERSION = "1.6.99"; // !final - - - private static final String loggerFactoryClassStr = AndroidLoggerFactory.class.getName(); - - /** - * The ILoggerFactory instance returned by the {@link #getLoggerFactory} method - * should always be the same object - */ - private final ILoggerFactory loggerFactory; - - private StaticLoggerBinder() { - loggerFactory = new AndroidLoggerFactory(); - } - - public ILoggerFactory getLoggerFactory() { - return loggerFactory; - } - - public String getLoggerFactoryClassStr() { - return loggerFactoryClassStr; - } -} diff --git a/slf4j-android/src/main/java/org/slf4j/impl/StaticMDCBinder.java b/slf4j-android/src/main/java/org/slf4j/impl/StaticMDCBinder.java deleted file mode 100644 index a484c525..00000000 --- a/slf4j-android/src/main/java/org/slf4j/impl/StaticMDCBinder.java +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Copyright (c) 2004-2013 QOS.ch - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - */ -package org.slf4j.impl; - -import org.slf4j.helpers.NOPMDCAdapter; -import org.slf4j.spi.MDCAdapter; - - -/** - * This implementation is bound to {@link NOPMDCAdapter}. - * - * @author Ceki Gülcü - * @author Andrey Korzhevskiy <a.korzhevskiy@gmail.com> - */ -public class StaticMDCBinder { - - /** - * The unique instance of this class. - */ - public static final StaticMDCBinder SINGLETON = new StaticMDCBinder(); - - private StaticMDCBinder() { - } - - /** - * Currently this method always returns an instance of - * {@link NOPMDCAdapter}. - */ - public MDCAdapter getMDCA() { - return new NOPMDCAdapter(); - } - - public String getMDCAdapterClassStr() { - return NOPMDCAdapter.class.getName(); - } -} diff --git a/slf4j-android/src/main/java/org/slf4j/impl/StaticMarkerBinder.java b/slf4j-android/src/main/java/org/slf4j/impl/StaticMarkerBinder.java deleted file mode 100644 index 52b05bac..00000000 --- a/slf4j-android/src/main/java/org/slf4j/impl/StaticMarkerBinder.java +++ /dev/null @@ -1,67 +0,0 @@ -/** - * Copyright (c) 2004-2013 QOS.ch - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - */ -package org.slf4j.impl; - -import org.slf4j.IMarkerFactory; -import org.slf4j.MarkerFactory; -import org.slf4j.helpers.BasicMarkerFactory; -import org.slf4j.spi.MarkerFactoryBinder; - -/** - * - * The binding of {@link MarkerFactory} class with an actual instance of - * {@link IMarkerFactory} is performed using information returned by this class. - * - * @author Ceki Gülcü - * @author Andrey Korzhevskiy <a.korzhevskiy@gmail.com> - */ -public class StaticMarkerBinder implements MarkerFactoryBinder { - - /** - * The unique instance of this class. - */ - public static final StaticMarkerBinder SINGLETON = new StaticMarkerBinder(); - - final IMarkerFactory markerFactory = new BasicMarkerFactory(); - - private StaticMarkerBinder() { - } - - /** - * Currently this method always returns an instance of - * {@link BasicMarkerFactory}. - */ - public IMarkerFactory getMarkerFactory() { - return markerFactory; - } - - /** - * Currently, this method returns the class name of - * {@link BasicMarkerFactory}. - */ - public String getMarkerFactoryClassStr() { - return BasicMarkerFactory.class.getName(); - } -} diff --git a/slf4j-android/src/main/resources/META-INF/MANIFEST.MF b/slf4j-android/src/main/resources/META-INF/MANIFEST.MF deleted file mode 100644 index d71f94cb..00000000 --- a/slf4j-android/src/main/resources/META-INF/MANIFEST.MF +++ /dev/null @@ -1,9 +0,0 @@ -Implementation-Title: slf4j-android -Bundle-ManifestVersion: 2 -Bundle-SymbolicName: slf4j.android -Bundle-Name: slf4j-android -Bundle-Vendor: SLF4J.ORG -Bundle-RequiredExecutionEnvironment: J2SE-1.5 -Export-Package: org.slf4j.impl;version=${parsedVersion.osgiVersion} -Import-Package: org.slf4j;version=${parsedVersion.osgiVersion}, org.slf4j.spi;version=${parsedVersion.osgiVersion}, org.slf4j.helpers;version=${parsedVersion.osgiVersion} -Fragment-Host: slf4j.api
\ No newline at end of file diff --git a/slf4j-android/src/test/java/org/slf4j/impl/AndroidLoggerFactoryTest.java b/slf4j-android/src/test/java/org/slf4j/impl/AndroidLoggerFactoryTest.java deleted file mode 100644 index 5c854892..00000000 --- a/slf4j-android/src/test/java/org/slf4j/impl/AndroidLoggerFactoryTest.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2004-2013 QOS.ch - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - */ -package org.slf4j.impl; - -import org.junit.Test; - -import static junit.framework.Assert.assertEquals; - -public class AndroidLoggerFactoryTest { - @Test - public void shortLoggerNames() { - assertEquals("o.test.p.TestClass", AndroidLoggerFactory.loggerNameToTag("o.test.p.TestClass")); - assertEquals("ex.test.TestClass", AndroidLoggerFactory.loggerNameToTag("ex.test.TestClass")); - assertEquals("MyClass", AndroidLoggerFactory.loggerNameToTag("MyClass")); - } - - @Test - public void emptyLoggerNames() { - assertEquals(AndroidLoggerFactory.ANONYMOUS_TAG, AndroidLoggerFactory.loggerNameToTag(null)); - assertEquals("", AndroidLoggerFactory.loggerNameToTag("")); - } - - @Test - public void simpleLoggerName() { - assertEquals("o*.t*.p*.TestClass", AndroidLoggerFactory.loggerNameToTag("org.test.package.TestClass")); - } - - @Test - public void loggerNameWithOneCharPackage() { - assertEquals("o.t*.p*.p*.TestClass", AndroidLoggerFactory.loggerNameToTag("o.test.project.package.TestClass")); - assertEquals("o.t*.p*.p.TestClass", AndroidLoggerFactory.loggerNameToTag("o.test.project.p.TestClass")); - } - - @Test - public void longLoggerName() { - assertEquals("AndroidLoggerFactory", AndroidLoggerFactory.loggerNameToTag("org.slf4j.impl.AndroidLoggerFactory")); - } - - @Test - public void veryLongLoggerName() { - assertEquals("*meAndShouldBeTruncated", AndroidLoggerFactory.loggerNameToTag("IAmAVeryLongLoggerNameAndShouldBeTruncated")); - } - - @Test - public void oneWordLoggerName() { - assertEquals("TestClass", AndroidLoggerFactory.loggerNameToTag("TestClass")); - } - - @Test - public void weirdLoggerNames() { - assertEquals("WeirdLoggerName.", AndroidLoggerFactory.loggerNameToTag("WeirdLoggerName.")); - assertEquals(".WeirdLoggerName", AndroidLoggerFactory.loggerNameToTag(".WeirdLoggerName")); - assertEquals(".WeirdLoggerName.", AndroidLoggerFactory.loggerNameToTag(".WeirdLoggerName.")); - assertEquals(".", AndroidLoggerFactory.loggerNameToTag(".")); - assertEquals("..", AndroidLoggerFactory.loggerNameToTag("..")); - } -} |