Skip to content

Commit

Permalink
Exclude logger classes from test coverage metrics
Browse files Browse the repository at this point in the history
Nobody cares if logger.trace has never been called...
  • Loading branch information
Col-E committed Nov 18, 2024
1 parent 85d8186 commit b9304ba
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import jakarta.annotation.Nonnull;
import org.slf4j.Logger;
import software.coley.recaf.util.ExcludeFromJacocoGeneratedReport;

import java.util.function.Consumer;

Expand All @@ -11,6 +12,7 @@
*
* @author Matt Coley
*/
@ExcludeFromJacocoGeneratedReport(justification = "Logging not relevant for test coverage")
public interface DebuggingLogger extends Logger {
boolean DEBUG = System.getenv("RECAF_DEBUG") != null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import org.slf4j.Logger;
import org.slf4j.Marker;
import org.slf4j.event.Level;
import software.coley.recaf.util.ExcludeFromJacocoGeneratedReport;

import java.util.regex.Matcher;

Expand All @@ -12,6 +13,7 @@
*
* @author Matt Coley
*/
@ExcludeFromJacocoGeneratedReport(justification = "Logging not relevant for test coverage")
public abstract class InterceptingLogger implements DebuggingLogger {
private final Logger backing;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.event.Level;
import software.coley.recaf.util.ExcludeFromJacocoGeneratedReport;

import java.nio.file.Path;
import java.util.ArrayList;
Expand All @@ -26,6 +27,7 @@
*
* @author Matt Coley
*/
@ExcludeFromJacocoGeneratedReport(justification = "Logging not relevant for test coverage")
public class Logging {
private static final Map<String, DebuggingLogger> loggers = new ConcurrentHashMap<>();
private static final NavigableSet<String> loggerKeys = Collections.synchronizedNavigableSet(new TreeSet<>());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
import ch.qos.logback.core.filter.Filter;
import ch.qos.logback.core.spi.FilterReply;
import jakarta.annotation.Nonnull;
import software.coley.recaf.util.ExcludeFromJacocoGeneratedReport;

/**
* Logging filter impl that only allows Recaf logger calls.
*
* @author Matt Coley
*/
@ExcludeFromJacocoGeneratedReport(justification = "Logging not relevant for test coverage")
public class RecafLoggingFilter extends Filter<ILoggingEvent> {
@Override
public FilterReply decide(@Nonnull ILoggingEvent event) {
Expand Down

0 comments on commit b9304ba

Please sign in to comment.