Skip to content

Commit

Permalink
[java] Reduce noisy logs from CDP version finder
Browse files Browse the repository at this point in the history
Related to #11088
  • Loading branch information
pujagani committed Oct 12, 2022
1 parent 877c34d commit b2d8eb0
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions java/src/org/openqa/selenium/devtools/CdpVersionFinder.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.util.Optional;
import java.util.ServiceLoader;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
Expand Down Expand Up @@ -121,7 +122,7 @@ private Optional<CdpInfo> findNearestMatch(int version) {

for (CdpInfo info : infos) {
if (info.getMajorVersion() == version) {
LOG.info(String.format("Found exact CDP implementation for version %d", version));
LOG.log(Level.FINE, "Found exact CDP implementation for version {0}", version);
return Optional.of(info);
}

Expand All @@ -137,15 +138,12 @@ private Optional<CdpInfo> findNearestMatch(int version) {
}
}

LOG.warning(String.format(
"Unable to find an exact match for CDP version %d, so returning the closest version found: %s",
version,
nearestMatch == null ? "a no-op implementation" : nearestMatch.getMajorVersion()));

if (nearestMatch == null) {
LOG.info(String.format("Unable to find CDP implementation matching %d.", version));
LOG.log(Level.WARNING, "Unable to find CDP implementation matching {0}", version);
} else {
LOG.info(String.format("Found CDP implementation for version %d of %d", version, nearestMatch.getMajorVersion()));
LOG.log(Level.WARNING,
"Unable to find an exact match for CDP version {0}, so returning the closest version found: {1}",
new Object[]{version, nearestMatch.getMajorVersion()});
}

return Optional.ofNullable(nearestMatch);
Expand Down

0 comments on commit b2d8eb0

Please sign in to comment.