diff --git a/eclipse-solargraph-plugin/src/main/java/io/github/pyvesb/eclipse_solargraph/launch/debug/ReadaptDebugDelegate.java b/eclipse-solargraph-plugin/src/main/java/io/github/pyvesb/eclipse_solargraph/launch/debug/ReadaptDebugDelegate.java index 959d2f1..26cdb7f 100644 --- a/eclipse-solargraph-plugin/src/main/java/io/github/pyvesb/eclipse_solargraph/launch/debug/ReadaptDebugDelegate.java +++ b/eclipse-solargraph-plugin/src/main/java/io/github/pyvesb/eclipse_solargraph/launch/debug/ReadaptDebugDelegate.java @@ -65,8 +65,7 @@ public void launch(ILaunchConfiguration configuration, String mode, ILaunch laun try { super.launch(builder); } catch (CoreException e) { - String msg = "Exception when launching readapt: " + String.join(" ", readaptCommand); - LogHelper.error(msg); + LogHelper.error("Exception when launching readapt: " + String.join(" ", readaptCommand), e); return; } diff --git a/eclipse-solargraph-plugin/src/main/java/io/github/pyvesb/eclipse_solargraph/utils/CommandJob.java b/eclipse-solargraph-plugin/src/main/java/io/github/pyvesb/eclipse_solargraph/utils/CommandJob.java index 110e207..d9adf35 100644 --- a/eclipse-solargraph-plugin/src/main/java/io/github/pyvesb/eclipse_solargraph/utils/CommandJob.java +++ b/eclipse-solargraph-plugin/src/main/java/io/github/pyvesb/eclipse_solargraph/utils/CommandJob.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2019 Pierre-Yves B. and others. + * Copyright (c) 2019-2024 Pierre-Yves B. and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -51,7 +51,7 @@ protected IStatus run(IProgressMonitor monitor) { return Status.OK_STATUS; } else { LogHelper.error("Unexpected exit value " + exitValue + " from command " + commandString - + System.lineSeparator() + "Error details:" + System.lineSeparator() + error.get(), null); + + System.lineSeparator() + "Error details:" + System.lineSeparator() + error.get()); } } catch (IOException | ExecutionException e) { LogHelper.error("Exception whilst running command " + commandString, e); diff --git a/eclipse-solargraph-plugin/src/main/java/io/github/pyvesb/eclipse_solargraph/utils/LaunchHelper.java b/eclipse-solargraph-plugin/src/main/java/io/github/pyvesb/eclipse_solargraph/utils/LaunchHelper.java index 835f6db..11be8df 100644 --- a/eclipse-solargraph-plugin/src/main/java/io/github/pyvesb/eclipse_solargraph/utils/LaunchHelper.java +++ b/eclipse-solargraph-plugin/src/main/java/io/github/pyvesb/eclipse_solargraph/utils/LaunchHelper.java @@ -5,7 +5,6 @@ import java.util.concurrent.CompletableFuture; import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.jobs.Job; import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.ILaunch; @@ -38,14 +37,12 @@ public static Job createJob(ILaunch launch, String command, File workingDirector } int exc = process.exitValue(); if (exc != 0) { - String msg = String.format("Process exited non-zero (%d): %s ", exc, command); - LogHelper.error(msg); + LogHelper.error(String.format("Process exited non-zero (%d): %s ", exc, command)); } }); DebugPlugin.newProcess(launch, process, command); } catch (CoreException e) { - // CoreException from exec - LogHelper.log(IStatus.ERROR, "Exception when launching process: " + command, e); + LogHelper.error("Exception when launching process: " + command, e); return; } }); diff --git a/eclipse-solargraph-plugin/src/main/java/io/github/pyvesb/eclipse_solargraph/utils/LogHelper.java b/eclipse-solargraph-plugin/src/main/java/io/github/pyvesb/eclipse_solargraph/utils/LogHelper.java index 1835d70..79aaea5 100644 --- a/eclipse-solargraph-plugin/src/main/java/io/github/pyvesb/eclipse_solargraph/utils/LogHelper.java +++ b/eclipse-solargraph-plugin/src/main/java/io/github/pyvesb/eclipse_solargraph/utils/LogHelper.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2019 Pierre-Yves B. and others. + * Copyright (c) 2019-2024 Pierre-Yves B. and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -25,28 +25,20 @@ public class LogHelper { private static final String LOGNAME = BUNDLE.getSymbolicName(); private static final ILog LOGGER = Platform.getLog(BUNDLE); - public static void log(int severity, String message) { - LOGGER.log(new Status(severity, LOGNAME, message)); - } - - public static void log(int severity, String message, Throwable throwable) { - LOGGER.log(new Status(severity, LOGNAME, message, throwable)); - } - public static void info(String message) { - log(IStatus.INFO, message); + LOGGER.log(new Status(IStatus.INFO, LOGNAME, message)); } public static void error(String message, Throwable exception) { - log(IStatus.ERROR, message, exception); + LOGGER.log(new Status(IStatus.ERROR, LOGNAME, message, exception)); } public static void error(String message) { - log(IStatus.ERROR, message); + LOGGER.log(new Status(IStatus.ERROR, LOGNAME, message)); } public static void cancelled(String message) { - log(IStatus.CANCEL, message); + LOGGER.log(new Status(IStatus.CANCEL, LOGNAME, message)); } private LogHelper() {