Skip to content

Commit

Permalink
applied formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
ceki committed Feb 24, 2016
1 parent ac099e4 commit 2073510
Show file tree
Hide file tree
Showing 66 changed files with 182 additions and 200 deletions.
3 changes: 1 addition & 2 deletions integration/src/test/java/org/slf4j/issues/Issue324Test.java
Expand Up @@ -7,10 +7,9 @@

public class Issue324Test extends TestCase {


public void testLoggerCreationInPresenseOfSecurityManager() {
String currentDir = System.getProperty("user.dir");
System.out.println("currentDir:"+currentDir);
System.out.println("currentDir:" + currentDir);
Logger logger = LoggerFactory.getLogger(Issue324Test.class);
logger.debug("hello");
}
Expand Down
Expand Up @@ -33,6 +33,7 @@
import org.junit.Before;
import org.junit.Test;
import org.slf4j.LoggerFactory;

public class SLF4JBridgeHandlerPerfTest {

static String LOGGER_NAME = "yay";
Expand All @@ -50,7 +51,6 @@ public class SLF4JBridgeHandlerPerfTest {

Handler[] existingHandlers;


@Before
public void setUp() throws Exception {
fileAppender = new FileAppender(new PatternLayout("%r [%t] %p %c %x - %m%n"), "target/test-output/toto.log");
Expand Down
Expand Up @@ -35,15 +35,15 @@
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
public class SLF4JBridgeHandlerTest {

public class SLF4JBridgeHandlerTest {

static String LOGGER_NAME = "yay";

ListAppender listAppender = new ListAppender();
org.apache.log4j.Logger log4jRoot;
java.util.logging.Logger julLogger = java.util.logging.Logger.getLogger("yay");


@Before
public void setUp() throws Exception {
listAppender.extractLocationInfo = true;
Expand Down Expand Up @@ -179,18 +179,18 @@ public void testLogWithPlaceholderNoParameters() {
}

// See http://jira.qos.ch/browse/SLF4J-337

@Test
public void illFormattedInputShouldBeReturnedAsIs() {
SLF4JBridgeHandler.install();
String msg = "foo {18=bad} {0}";

julLogger.log(Level.INFO, msg, "ignored parameter due to IllegalArgumentException");
assertEquals(1, listAppender.list.size());
LoggingEvent le = (LoggingEvent) listAppender.list.get(0);
assertEquals(msg, le.getMessage());
}

void assertLevel(int index, org.apache.log4j.Level expectedLevel) {
LoggingEvent le = (LoggingEvent) listAppender.list.get(index);
assertEquals(expectedLevel, le.getLevel());
Expand Down
6 changes: 3 additions & 3 deletions log4j-over-slf4j/src/main/java/org/apache/log4j/Category.java
Expand Up @@ -346,13 +346,13 @@ public void addAppender(Appender newAppender) {
public void setLevel(Level level) {
// nothing to do
}

public boolean getAdditivity() {
return false;
}

public void assertLog(boolean assertion, String msg) {
if(!assertion)
if (!assertion)
error(msg);
}

Expand Down
3 changes: 2 additions & 1 deletion log4j-over-slf4j/src/test/java/org/dummy/Bug131.java
Expand Up @@ -32,7 +32,8 @@
import org.apache.log4j.Category;
import org.apache.log4j.Logger;
import org.junit.Test;
public class Bug131 {

public class Bug131 {

@Test
public void testBug131() {
Expand Down
2 changes: 1 addition & 1 deletion log4j-over-slf4j/src/test/java/org/dummy/Bug139.java
Expand Up @@ -33,7 +33,7 @@
import org.apache.log4j.Logger;
import org.junit.Test;

public class Bug139 {
public class Bug139 {

@Test
public void test() {
Expand Down
Expand Up @@ -81,7 +81,6 @@
class AndroidLoggerAdapter extends MarkerIgnoringBase {
private static final long serialVersionUID = -1227274521521287937L;


/**
* Package access allows only {@link AndroidLoggerFactory} to instantiate
* SimpleLogger instances.
Expand Down
Expand Up @@ -117,8 +117,7 @@ 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);
return lastPeriodIndex != -1 && length - (lastPeriodIndex + 1) <= TAG_MAX_LENGTH ? loggerName.substring(lastPeriodIndex + 1) : '*' + loggerName
.substring(length - TAG_MAX_LENGTH + 1);
}
}
Expand Up @@ -58,8 +58,6 @@ public static StaticLoggerBinder getSingleton() {
// 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();

/**
Expand Down
56 changes: 28 additions & 28 deletions slf4j-android/src/main/java/org/slf4j/impl/StaticMDCBinder.java
Expand Up @@ -27,7 +27,6 @@
import org.slf4j.helpers.NOPMDCAdapter;
import org.slf4j.spi.MDCAdapter;


/**
* This implementation is bound to {@link NOPMDCAdapter}.
*
Expand All @@ -36,32 +35,33 @@
*/
public class StaticMDCBinder {

/**
* The unique instance of this class.
*/
public static final StaticMDCBinder SINGLETON = new StaticMDCBinder();
/**
* The unique instance of this class.
*/
public static final StaticMDCBinder SINGLETON = new StaticMDCBinder();

private StaticMDCBinder() {
}

/**
* Return the singleton of this class.
*
* @return the StaticMDCBinder singleton
* @since 1.7.14
*/
public static final StaticMDCBinder getSingleton() {
return SINGLETON;
}

/**
* Currently this method always returns an instance of
* {@link NOPMDCAdapter}.
*/
public MDCAdapter getMDCA() {
return new NOPMDCAdapter();
}

private StaticMDCBinder() {
}

/**
* Return the singleton of this class.
*
* @return the StaticMDCBinder singleton
* @since 1.7.14
*/
public static final StaticMDCBinder getSingleton() {
return SINGLETON;
}
/**
* Currently this method always returns an instance of
* {@link NOPMDCAdapter}.
*/
public MDCAdapter getMDCA() {
return new NOPMDCAdapter();
}

public String getMDCAdapterClassStr() {
return NOPMDCAdapter.class.getName();
}
public String getMDCAdapterClassStr() {
return NOPMDCAdapter.class.getName();
}
}
70 changes: 35 additions & 35 deletions slf4j-android/src/main/java/org/slf4j/impl/StaticMarkerBinder.java
Expand Up @@ -39,39 +39,39 @@
*/
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() {
}
/**
* Return the singleton of this class.
*
* @return the StaticMarkerBinder singleton
* @since 1.7.14
*/
public static StaticMarkerBinder getSingleton() {
return SINGLETON;
}
/**
* 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();
}
/**
* The unique instance of this class.
*/
public static final StaticMarkerBinder SINGLETON = new StaticMarkerBinder();

final IMarkerFactory markerFactory = new BasicMarkerFactory();

private StaticMarkerBinder() {
}

/**
* Return the singleton of this class.
*
* @return the StaticMarkerBinder singleton
* @since 1.7.14
*/
public static StaticMarkerBinder getSingleton() {
return SINGLETON;
}

/**
* 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();
}
}
8 changes: 4 additions & 4 deletions slf4j-api/src/main/java/org/slf4j/LoggerFactory.java
Expand Up @@ -139,7 +139,7 @@ private final static void bind() {
try {
Set<URL> staticLoggerBinderPathSet = null;
// skip check under android, see also http://jira.qos.ch/browse/SLF4J-328
if(!isAndroid()) {
if (!isAndroid()) {
staticLoggerBinderPathSet = findPossibleStaticLoggerBinderPathSet();
reportMultipleBindingAmbiguity(staticLoggerBinderPathSet);
}
Expand Down Expand Up @@ -191,15 +191,15 @@ private static void playRecordedEvents() {
for (int i = 0; i < events.size(); i++) {
SubstituteLoggingEvent event = events.get(i);
SubstituteLogger substLogger = event.getLogger();
if( substLogger.isDelegateNOP()) {
if (substLogger.isDelegateNOP()) {
break;
} else if (substLogger.isDelegateEventAware()) {
if (i == 0)
emitReplayWarning(events.size());
substLogger.log(event);
} else {
if(i == 0)
emitSubstitutionWarning();
if (i == 0)
emitSubstitutionWarning();
Util.report(substLogger.getName());
}
}
Expand Down
3 changes: 1 addition & 2 deletions slf4j-api/src/main/java/org/slf4j/event/EventConstants.java
Expand Up @@ -2,13 +2,12 @@

import org.slf4j.spi.LocationAwareLogger;


public class EventConstants {
public static final int ERROR_INT = LocationAwareLogger.ERROR_INT;
public static final int WARN_INT = LocationAwareLogger.WARN_INT;
public static final int INFO_INT = LocationAwareLogger.INFO_INT;
public static final int DEBUG_INT = LocationAwareLogger.DEBUG_INT;
public static final int TRACE_INT = LocationAwareLogger.TRACE_INT;
public static final String NA_SUBST = "NA/SubstituteLogger";

}
13 changes: 6 additions & 7 deletions slf4j-api/src/main/java/org/slf4j/event/EventRecodingLogger.java
Expand Up @@ -13,9 +13,9 @@ public class EventRecodingLogger implements Logger {
List<SubstituteLoggingEvent> eventList;

public EventRecodingLogger(SubstituteLogger logger, List<SubstituteLoggingEvent> eventList) {
this.logger = logger;
this.name = logger.getName();
this.eventList = eventList;
this.logger = logger;
this.name = logger.getName();
this.eventList = eventList;
}

public String getName() {
Expand All @@ -27,14 +27,13 @@ private void recordEvent(Level level, String msg, Object[] args, Throwable throw
}

private void recordEvent(Level level, Marker marker, String msg, Object[] args, Throwable throwable) {
//System.out.println("recording logger:"+name+", msg:"+msg);
// System.out.println("recording logger:"+name+", msg:"+msg);
SubstituteLoggingEvent loggingEvent = new SubstituteLoggingEvent();
loggingEvent.setTimeStamp(System.currentTimeMillis());
loggingEvent.setLevel(level);
loggingEvent.setLogger(logger);
loggingEvent.setLoggerName(name);



loggingEvent.setMessage(msg);
loggingEvent.setArgumentArray(args);
loggingEvent.setThrowable(throwable);
Expand Down Expand Up @@ -207,7 +206,7 @@ public void warn(String format, Object arg) {
public void warn(String format, Object arg1, Object arg2) {
recordEvent(Level.WARN, format, new Object[] { arg1, arg2 }, null);
}

public void warn(String format, Object... arguments) {
recordEvent(Level.WARN, format, arguments, null);
}
Expand Down
3 changes: 1 addition & 2 deletions slf4j-api/src/main/java/org/slf4j/event/Level.java
Expand Up @@ -13,8 +13,7 @@
*/
public enum Level {

ERROR(ERROR_INT, "ERROR"), WARN(WARN_INT, "WARN"), INFO(INFO_INT, "INFO"),
DEBUG(DEBUG_INT, "DEBUG"), TRACE(TRACE_INT, "TRACE");
ERROR(ERROR_INT, "ERROR"), WARN(WARN_INT, "WARN"), INFO(INFO_INT, "INFO"), DEBUG(DEBUG_INT, "DEBUG"), TRACE(TRACE_INT, "TRACE");

private int levelInt;
private String levelStr;
Expand Down
8 changes: 7 additions & 1 deletion slf4j-api/src/main/java/org/slf4j/event/LoggingEvent.java
Expand Up @@ -2,7 +2,6 @@

import org.slf4j.Marker;


/**
*
* @author ceki
Expand All @@ -11,12 +10,19 @@
public interface LoggingEvent {

Level getLevel();

Marker getMarker();

String getLoggerName();

String getMessage();

String getThreadName();

Object[] getArgumentArray();

long getTimeStamp();

Throwable getThrowable();

}

0 comments on commit 2073510

Please sign in to comment.