Back to project page slf4android.
The source code is released under:
MIT License
If you think the Android project slf4android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package pl.brightinventions.slf4android; /* w w w . j av a 2 s . c o m*/ import android.text.TextUtils; public class HandlerFormatterCompiler { private final LoggerPatternConfiguration configuration; public HandlerFormatterCompiler(LoggerPatternConfiguration configuration) { this.configuration = configuration; } public LogRecordFormatter compile(String formatterPattern) { ListLogRecordFormatter formatter = new ListLogRecordFormatter(); while (!TextUtils.isEmpty(formatterPattern)) { int firstPatternIndex = Integer.MAX_VALUE; LoggerPattern firstPattern = null; for (LoggerPattern loggerPattern : configuration.getPatterns()) { String pattern = loggerPattern.getPattern(); int patternIndex = formatterPattern.indexOf(pattern); if (patternIndex != -1 && patternIndex < firstPatternIndex) { firstPatternIndex = patternIndex; firstPattern = loggerPattern; } } if (firstPattern != null) { if (firstPatternIndex > 0) { formatter.add(new ConstLoggerValueSupplier(formatterPattern.substring(0, firstPatternIndex))); } formatter.add(firstPattern); formatterPattern = formatterPattern.substring(firstPatternIndex + firstPattern.getPattern().length()); } else { formatter.add(new ConstLoggerValueSupplier(formatterPattern)); formatterPattern = null; } } return formatter; } }