Skip to content

Commit c6e17a6

Browse files
travkin79rubenporras
authored andcommitted
Use LSP4E logging convenience methods
1 parent 5d8be6e commit c6e17a6

2 files changed

Lines changed: 15 additions & 5 deletions

File tree

org.eclipse.lsp4e/src/org/eclipse/lsp4e/LanguageServerPlugin.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*******************************************************************************/
1212
package org.eclipse.lsp4e;
1313

14-
import static java.nio.charset.StandardCharsets.UTF_8;
14+
import static java.nio.charset.StandardCharsets.*;
1515

1616
import java.util.concurrent.ConcurrentHashMap;
1717
import java.util.concurrent.ConcurrentMap;
@@ -91,6 +91,16 @@ protected void initializeImageRegistry(ImageRegistry registry) {
9191
LSPImages.initalize(registry);
9292
}
9393

94+
/**
95+
* Utility method to log errors.
96+
*
97+
* @param message
98+
* User comprehensible message
99+
*/
100+
public static void logError(final String message) {
101+
logError(message, null);
102+
}
103+
94104
/**
95105
* Utility method to log errors.
96106
*

org.eclipse.lsp4e/src/org/eclipse/lsp4e/operations/symbols/internal/SymbolIconProviderRegistry.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ private void loadExtensions() {
6363
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(EXTENSION_POINT_ID);
6464

6565
if (extensionPoint == null) {
66-
Platform.getLog(getClass()).error("No extension point found for ID " + EXTENSION_POINT_ID); //$NON-NLS-1$
66+
LanguageServerPlugin.logError("No extension point found for ID " + EXTENSION_POINT_ID); //$NON-NLS-1$
6767
return;
6868
}
6969

@@ -79,7 +79,7 @@ private void loadExtensions() {
7979
try {
8080
iconProvider = (SymbolIconProvider) configurationElement.createExecutableExtension("class"); //$NON-NLS-1$
8181
} catch (CoreException | ClassCastException e) {
82-
Platform.getLog(getClass()).error("Failed instantiating class " + className, e); //$NON-NLS-1$
82+
LanguageServerPlugin.logError("Failed instantiating class " + className, e); //$NON-NLS-1$
8383
continue;
8484
}
8585

@@ -110,7 +110,7 @@ private SymbolIconProvider getIconProvider(Object symbol) {
110110
try {
111111
fileName = Path.of(uri.getPath()).getFileName().toString();
112112
} catch (Exception e) {
113-
Platform.getLog(getClass()).warn("Failed to parse file name from URI " + uri, e); //$NON-NLS-1$
113+
LanguageServerPlugin.logWarning("Failed to parse file name from URI " + uri, e); //$NON-NLS-1$
114114
return defaultIconProvider;
115115
}
116116

@@ -151,7 +151,7 @@ private SymbolIconProvider getIconProvider(Object symbol) {
151151
try {
152152
return URI.create(uri);
153153
} catch (IllegalArgumentException e) {
154-
Platform.getLog(getClass()).warn("Failed to parse URI " + uri, e); //$NON-NLS-1$
154+
LanguageServerPlugin.logWarning("Failed to parse URI " + uri, e); //$NON-NLS-1$
155155
return null;
156156
}
157157
}

0 commit comments

Comments
 (0)