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:
parent
82ed9cc10b
commit
5f25b065aa
8 changed files with 144 additions and 146 deletions
|
@ -1,6 +1,10 @@
|
|||
package uk.xlab.teamcity.phabricator;
|
||||
|
||||
public interface IPhabricatorPluginLogger {
|
||||
|
||||
public void info(String message);
|
||||
|
||||
public void warn(String message, Exception e);
|
||||
|
||||
public void error(String message, Exception e);
|
||||
}
|
||||
|
|
|
@ -13,4 +13,9 @@ public final class PhabricatorAgentLogger implements IPhabricatorPluginLogger {
|
|||
public void warn(String message, Exception 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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,10 +3,9 @@ package uk.xlab.teamcity.phabricator;
|
|||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Holds all the parameters set on the build applied by the
|
||||
* harbormaster trigger from phabricator. It also has the
|
||||
* methods used to communicate the build result back to
|
||||
* harbormaster
|
||||
* Holds all the parameters set on the build applied by the harbormaster trigger
|
||||
* from phabricator. It also has the methods used to communicate the build
|
||||
* result back to harbormaster
|
||||
*
|
||||
* @author steven.cooney
|
||||
*
|
||||
|
@ -17,8 +16,8 @@ public class PhabricatorPluginConfig {
|
|||
private Map<String, String> params;
|
||||
|
||||
/**
|
||||
* Set the appropriate logger depending if the class is
|
||||
* called from the SERVER or AGENT
|
||||
* Set the appropriate logger depending if the class is called from the SERVER
|
||||
* or AGENT
|
||||
*
|
||||
* @param logger
|
||||
*/
|
||||
|
@ -27,8 +26,7 @@ public class PhabricatorPluginConfig {
|
|||
}
|
||||
|
||||
/**
|
||||
* Take a copy of all build parameters which will then
|
||||
* be parsed
|
||||
* Take a copy of all build parameters which will then be parsed
|
||||
*
|
||||
* @param parameters
|
||||
*/
|
||||
|
|
|
@ -14,12 +14,8 @@ public final class PhabricatorServerLogger implements IPhabricatorPluginLogger {
|
|||
Loggers.SERVER.warn(String.format("Phabricator Plugin: %s", message), e);
|
||||
}
|
||||
|
||||
// public void agentInfo(String message) {
|
||||
// Loggers.AGENT.info(String.format("Phabricator Plugin: %s", message));
|
||||
// }
|
||||
//
|
||||
// public void agentWarn(String message, Exception e) {
|
||||
// Loggers.AGENT.warn(String.format("Phabricator Plugin: %s", message), e);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void error(String message, Exception e) {
|
||||
Loggers.SERVER.error(String.format("Phabricator Plugin: %s", message), e);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,8 +8,7 @@ import jetbrains.buildServer.serverSide.SRunningBuild;
|
|||
import jetbrains.buildServer.util.EventDispatcher;
|
||||
|
||||
/**
|
||||
* Listen for builds been started and track their progress
|
||||
* with BuildTracker
|
||||
* Listen for builds been started and track their progress with BuildTracker
|
||||
*
|
||||
* @author steven.cooney
|
||||
*
|
||||
|
@ -18,10 +17,8 @@ public class PhabricatorBuildServerAdapter extends BuildServerAdapter {
|
|||
|
||||
private PhabricatorServerLogger logger;
|
||||
|
||||
public PhabricatorBuildServerAdapter(
|
||||
@NotNull final EventDispatcher<BuildServerListener> buildServerListener,
|
||||
@NotNull final PhabricatorServerLogger phabLogger
|
||||
) {
|
||||
public PhabricatorBuildServerAdapter(@NotNull final EventDispatcher<BuildServerListener> buildServerListener,
|
||||
@NotNull final PhabricatorServerLogger phabLogger) {
|
||||
buildServerListener.addListener(this);
|
||||
logger = phabLogger;
|
||||
|
||||
|
|
|
@ -12,10 +12,8 @@ public class PhabricatorPluginBuildFeature extends BuildFeature {
|
|||
private final String myEditUrl;
|
||||
private PhabricatorServerLogger logger;
|
||||
|
||||
public PhabricatorPluginBuildFeature(
|
||||
@NotNull final PluginDescriptor pluginDescriptor,
|
||||
@NotNull final PhabricatorServerLogger phabLogger
|
||||
) {
|
||||
public PhabricatorPluginBuildFeature(@NotNull final PluginDescriptor pluginDescriptor,
|
||||
@NotNull final PhabricatorServerLogger phabLogger) {
|
||||
myEditUrl = pluginDescriptor.getPluginResourcesPath("phabricatorBuildFeature.jsp");
|
||||
logger = phabLogger;
|
||||
|
||||
|
@ -50,8 +48,8 @@ public class PhabricatorPluginBuildFeature extends BuildFeature {
|
|||
public String describeParameters(@NotNull final Map<String, String> params) {
|
||||
String url = "";
|
||||
|
||||
for(String key : params.keySet()){
|
||||
if(key.equals(Constants.PHABRICATOR_URL_SETTING)){
|
||||
for (String key : params.keySet()) {
|
||||
if (key.equals(Constants.PHABRICATOR_URL_SETTING)) {
|
||||
url = params.get(key);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue