1
0
Fork 0

Make Logging Class Generic

Allow either the agent or server loggers to be used with the wrapper class by making the set method use the interface rather than concrete class. Also rename the interface away from C# style naming.
This commit is contained in:
Steven Cooney 2019-06-03 17:27:19 +01:00
parent 7172047135
commit 951fe608b7
4 changed files with 6 additions and 6 deletions

View file

@ -2,7 +2,7 @@ package uk.xlab.teamcity.phabricator;
import jetbrains.buildServer.log.Loggers; import jetbrains.buildServer.log.Loggers;
public final class PhabricatorAgentLogger implements IPhabricatorPluginLogger { public final class PhabricatorAgentLogger implements PhabricatorPluginLogger {
@Override @Override
public void info(String message) { public void info(String message) {

View file

@ -15,7 +15,7 @@ import static uk.xlab.teamcity.phabricator.CommonUtils.*;
*/ */
public class PhabricatorPluginConfig { public class PhabricatorPluginConfig {
private IPhabricatorPluginLogger logger; private PhabricatorPluginLogger logger;
private Map<String, String> params; private Map<String, String> params;
// Build Feature Variables // Build Feature Variables
@ -35,7 +35,7 @@ public class PhabricatorPluginConfig {
* *
* @param logger * @param logger
*/ */
public void setLogger(PhabricatorServerLogger logger) { public void setLogger(PhabricatorPluginLogger logger) {
this.logger = logger; this.logger = logger;
} }
@ -65,7 +65,7 @@ public class PhabricatorPluginConfig {
case Constants.PHABRICATOR_CONDUIT_TOKEN_SETTING: case Constants.PHABRICATOR_CONDUIT_TOKEN_SETTING:
logger.info("Found Phabricator Conduit Token"); logger.info("Found Phabricator Conduit Token");
conduitToken = params.get(Constants.PHABRICATOR_CONDUIT_TOKEN_SETTING); conduitToken = params.get(Constants.PHABRICATOR_CONDUIT_TOKEN_SETTING);
case Constants.BRANCH_NAME: case Constants.BRANCH_NAME:
logger.info(String.format("Found branch name: %s", params.get(Constants.BRANCH_NAME))); logger.info(String.format("Found branch name: %s", params.get(Constants.BRANCH_NAME)));
branchName = params.get(Constants.BRANCH_NAME); branchName = params.get(Constants.BRANCH_NAME);

View file

@ -1,6 +1,6 @@
package uk.xlab.teamcity.phabricator; package uk.xlab.teamcity.phabricator;
public interface IPhabricatorPluginLogger { public interface PhabricatorPluginLogger {
public void info(String message); public void info(String message);

View file

@ -2,7 +2,7 @@ package uk.xlab.teamcity.phabricator;
import jetbrains.buildServer.log.Loggers; import jetbrains.buildServer.log.Loggers;
public final class PhabricatorServerLogger implements IPhabricatorPluginLogger { public final class PhabricatorServerLogger implements PhabricatorPluginLogger {
@Override @Override
public void info(String message) { public void info(String message) {