Skip to content

Commit

Permalink
SLCORE-1038 Remove workaround for suppressing noisy analyzer logs
Browse files Browse the repository at this point in the history
  • Loading branch information
nquinquenel committed Nov 13, 2024
1 parent 70984a5 commit 504f88a
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,12 @@
package org.sonarsource.sonarlint.core.commons.log;

import java.util.Optional;
import java.util.regex.Pattern;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
import org.sonarsource.sonarlint.core.commons.log.LogOutput.Level;

class LogOutputDelegator {

/**
* Temporary until the actual log is removed from sonar-analyzer-commons
* See SLCORE-520
*/
private static final Pattern SKIPPED_MESSAGE_PATTERN = Pattern.compile("^Skipping section '.*?' for rule '.*?', content is empty$");

private final InheritableThreadLocal<LogOutput> target = new InheritableThreadLocal<>();

void log(@Nullable String formattedMessage, Level level, @Nullable String stackTrace) {
Expand All @@ -42,9 +35,6 @@ void log(@Nullable String formattedMessage, Level level, @Nullable String stackT
return noLogOutputConfigured;
});
if (output != null) {
if (formattedMessage != null && level == Level.DEBUG && SKIPPED_MESSAGE_PATTERN.matcher(formattedMessage).matches()) {
return;
}
output.log(formattedMessage, level, stackTrace);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
package org.sonarsource.sonarlint.core.commons.log;

import org.junit.jupiter.api.Test;
import org.mockito.ArgumentMatchers;
import org.sonarsource.sonarlint.core.commons.log.LogOutput.Level;

import static org.assertj.core.api.Assertions.assertThat;
Expand Down Expand Up @@ -71,12 +70,4 @@ void handle_nulls() {
delegator.log(null, Level.ERROR, (Throwable) null);
verifyNoInteractions(output);
}

@Test
void should_not_log_skipped_message() {
var messageToSkip = "Skipping section 'introduction' for rule 'S123', content is empty";
delegator.setTarget(output);
delegator.log(messageToSkip, Level.DEBUG, (Throwable) null);
verifyNoInteractions(output);
}
}

0 comments on commit 504f88a

Please sign in to comment.