Skip to content

Commit 0549fd1

Browse files
fix: use debug log level for project filtering messages [IDE-1083]
Add logDebug method to SnykLogger (IStatus.OK level) and switch all diagnostic log messages in getAccessibleTopLevelProjects from logInfo to logDebug to avoid noise in production logs. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 599e64e commit 0549fd1

2 files changed

Lines changed: 13 additions & 7 deletions

File tree

plugin/src/main/java/io/snyk/eclipse/plugin/utils/ResourceUtils.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,24 +77,24 @@ public static IProject getProjectByPath(Path path) {
7777

7878
public static List<IProject> getAccessibleTopLevelProjects() {
7979
var allProjects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
80-
SnykLogger.logInfo("Workspace contains " + allProjects.length + " project(s)");
80+
SnykLogger.logDebug("Workspace contains " + allProjects.length + " project(s)");
8181

8282
for (IProject project : allProjects) {
8383
var path = getFullPath(project);
8484
if (!project.isAccessible()) {
85-
SnykLogger.logInfo("Project filtered (not accessible): " + project.getName() + PATH_LOG_PREFIX + path);
85+
SnykLogger.logDebug("Project filtered (not accessible): " + project.getName() + PATH_LOG_PREFIX + path);
8686
} else if (project.isDerived()) {
87-
SnykLogger.logInfo("Project filtered (derived): " + project.getName() + PATH_LOG_PREFIX + path);
87+
SnykLogger.logDebug("Project filtered (derived): " + project.getName() + PATH_LOG_PREFIX + path);
8888
} else if (project.isHidden()) {
89-
SnykLogger.logInfo("Project filtered (hidden): " + project.getName() + PATH_LOG_PREFIX + path);
89+
SnykLogger.logDebug("Project filtered (hidden): " + project.getName() + PATH_LOG_PREFIX + path);
9090
}
9191
}
9292

9393
var projects = Arrays.stream(allProjects).filter((project) -> {
9494
return project.isAccessible() && !project.isDerived() && !project.isHidden();
9595
}).sorted(projectByPathComparator).collect(Collectors.toList());
9696

97-
SnykLogger.logInfo("After filtering: " + projects.size() + " accessible project(s)");
97+
SnykLogger.logDebug("After filtering: " + projects.size() + " accessible project(s)");
9898

9999
Set<IProject> topLevel = new TreeSet<>(projectByPathComparator);
100100
for (IProject iProject : projects) {
@@ -104,7 +104,7 @@ public static List<IProject> getAccessibleTopLevelProjects() {
104104
var topLevelPath = ResourceUtils.getFullPath(tp);
105105
if (projectPath.startsWith(topLevelPath)) {
106106
isSubProject = true;
107-
SnykLogger.logInfo("Project filtered (sub-project of " + tp.getName() + "): " + iProject.getName() + PATH_LOG_PREFIX + projectPath);
107+
SnykLogger.logDebug("Project filtered (sub-project of " + tp.getName() + "): " + iProject.getName() + PATH_LOG_PREFIX + projectPath);
108108
break;
109109
}
110110
}
@@ -113,7 +113,7 @@ public static List<IProject> getAccessibleTopLevelProjects() {
113113
}
114114
}
115115

116-
SnykLogger.logInfo("Top-level projects: " + topLevel.stream().map(p -> p.getName() + "=" + getFullPath(p)).collect(Collectors.joining(", ")));
116+
SnykLogger.logDebug("Top-level projects: " + topLevel.stream().map(p -> p.getName() + "=" + getFullPath(p)).collect(Collectors.joining(", ")));
117117
return new ArrayList<>(topLevel);
118118
}
119119
}

plugin/src/main/java/io/snyk/eclipse/plugin/utils/SnykLogger.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ public static void logInfo(String message) {
2121
StatusManager.getManager().handle(status, StatusManager.LOG);
2222
}
2323

24+
public static void logDebug(String message) {
25+
Status status = new Status(IStatus.OK, Activator.PLUGIN_ID, message);
26+
27+
StatusManager.getManager().handle(status, StatusManager.LOG);
28+
}
29+
2430
public static void logAndShow(String message) {
2531
Status status = new Status(IStatus.INFO, Activator.PLUGIN_ID, message);
2632

0 commit comments

Comments
 (0)