1
0
Fork 0

Tidy up and add error option to logging

Formatted the files so far getting rid of theose pesky tabs. Also added the error logging options to the logging wrapper classes.
This commit is contained in:
Steven Cooney 2019-05-31 12:22:55 +01:00
parent 82ed9cc10b
commit 5f25b065aa
8 changed files with 144 additions and 146 deletions

View file

@ -1,6 +1,10 @@
package uk.xlab.teamcity.phabricator; package uk.xlab.teamcity.phabricator;
public interface IPhabricatorPluginLogger { public interface IPhabricatorPluginLogger {
public void info(String message); public void info(String message);
public void warn(String message, Exception e); public void warn(String message, Exception e);
public void error(String message, Exception e);
} }

View file

@ -13,4 +13,9 @@ public final class PhabricatorAgentLogger implements IPhabricatorPluginLogger {
public void warn(String message, Exception e) { public void warn(String message, Exception e) {
Loggers.AGENT.warn(String.format("Phabricator Plugin: %s", message), e); Loggers.AGENT.warn(String.format("Phabricator Plugin: %s", message), e);
} }
@Override
public void error(String message, Exception e) {
Loggers.AGENT.error(String.format("Phabricator Plugin: %s", message), e);
}
} }

View file

@ -3,10 +3,9 @@ package uk.xlab.teamcity.phabricator;
import java.util.Map; import java.util.Map;
/** /**
* Holds all the parameters set on the build applied by the * Holds all the parameters set on the build applied by the harbormaster trigger
* harbormaster trigger from phabricator. It also has the * from phabricator. It also has the methods used to communicate the build
* methods used to communicate the build result back to * result back to harbormaster
* harbormaster
* *
* @author steven.cooney * @author steven.cooney
* *
@ -17,8 +16,8 @@ public class PhabricatorPluginConfig {
private Map<String, String> params; private Map<String, String> params;
/** /**
* Set the appropriate logger depending if the class is * Set the appropriate logger depending if the class is called from the SERVER
* called from the SERVER or AGENT * or AGENT
* *
* @param logger * @param logger
*/ */
@ -27,8 +26,7 @@ public class PhabricatorPluginConfig {
} }
/** /**
* Take a copy of all build parameters which will then * Take a copy of all build parameters which will then be parsed
* be parsed
* *
* @param parameters * @param parameters
*/ */

View file

@ -14,12 +14,8 @@ public final class PhabricatorServerLogger implements IPhabricatorPluginLogger {
Loggers.SERVER.warn(String.format("Phabricator Plugin: %s", message), e); Loggers.SERVER.warn(String.format("Phabricator Plugin: %s", message), e);
} }
// public void agentInfo(String message) { @Override
// Loggers.AGENT.info(String.format("Phabricator Plugin: %s", message)); public void error(String message, Exception e) {
// } Loggers.SERVER.error(String.format("Phabricator Plugin: %s", message), e);
// }
// public void agentWarn(String message, Exception e) {
// Loggers.AGENT.warn(String.format("Phabricator Plugin: %s", message), e);
// }
} }

View file

@ -8,8 +8,7 @@ import jetbrains.buildServer.serverSide.SRunningBuild;
import jetbrains.buildServer.util.EventDispatcher; import jetbrains.buildServer.util.EventDispatcher;
/** /**
* Listen for builds been started and track their progress * Listen for builds been started and track their progress with BuildTracker
* with BuildTracker
* *
* @author steven.cooney * @author steven.cooney
* *
@ -18,10 +17,8 @@ public class PhabricatorBuildServerAdapter extends BuildServerAdapter {
private PhabricatorServerLogger logger; private PhabricatorServerLogger logger;
public PhabricatorBuildServerAdapter( public PhabricatorBuildServerAdapter(@NotNull final EventDispatcher<BuildServerListener> buildServerListener,
@NotNull final EventDispatcher<BuildServerListener> buildServerListener, @NotNull final PhabricatorServerLogger phabLogger) {
@NotNull final PhabricatorServerLogger phabLogger
) {
buildServerListener.addListener(this); buildServerListener.addListener(this);
logger = phabLogger; logger = phabLogger;

View file

@ -12,10 +12,8 @@ public class PhabricatorPluginBuildFeature extends BuildFeature {
private final String myEditUrl; private final String myEditUrl;
private PhabricatorServerLogger logger; private PhabricatorServerLogger logger;
public PhabricatorPluginBuildFeature( public PhabricatorPluginBuildFeature(@NotNull final PluginDescriptor pluginDescriptor,
@NotNull final PluginDescriptor pluginDescriptor, @NotNull final PhabricatorServerLogger phabLogger) {
@NotNull final PhabricatorServerLogger phabLogger
) {
myEditUrl = pluginDescriptor.getPluginResourcesPath("phabricatorBuildFeature.jsp"); myEditUrl = pluginDescriptor.getPluginResourcesPath("phabricatorBuildFeature.jsp");
logger = phabLogger; logger = phabLogger;