Skip to content

Commit

Permalink
#169 - Use parameterised log statements
Browse files Browse the repository at this point in the history
  • Loading branch information
gazbert committed Nov 13, 2024
1 parent d924af4 commit 4b2dc6f
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public EmailAlertsConfig get() {

@Override
public EmailAlertsConfig save(EmailAlertsConfig config) {
log.info("About to save EmailAlertsConfig: " + config);
log.info("About to save EmailAlertsConfig: {}", config);

final EmailAlertsType emailAlertsType = new EmailAlertsType();
emailAlertsType.setEmailAlerts(config);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public EngineConfig get() {

@Override
public EngineConfig save(EngineConfig config) {
log.info("About to save EngineConfig: " + config);
log.info("About to save EngineConfig: {}", config);

final EngineType engineType = new EngineType();
engineType.setEngine(config);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public ExchangeConfig get() {

@Override
public ExchangeConfig save(ExchangeConfig config) {
log.info("About to save ExchangeConfig: " + config);
log.info("About to save ExchangeConfig: {}", config);

final ExchangeType exchangeType = new ExchangeType();
exchangeType.setExchange(config);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public List<MarketConfig> findAll() {

@Override
public MarketConfig findById(String id) {
log.info("Fetching Market config for id: " + id);
log.info("Fetching Market config for id: {}", id);

final MarketsType marketsType =
configurationManager.loadConfig(MarketsType.class, MARKETS_CONFIG_YAML_FILENAME);
Expand All @@ -94,7 +94,7 @@ public MarketConfig save(MarketConfig config) {
.toList();

if (config.getId() == null || config.getId().isEmpty()) {
log.info("About to create MarketConfig: " + config);
log.info("About to create MarketConfig: {}", config);

if (marketConfigs.isEmpty()) {
final MarketConfig newMarketConfig = new MarketConfig(config);
Expand All @@ -114,7 +114,7 @@ public MarketConfig save(MarketConfig config) {
+ marketsType.getMarkets());
}
} else {
log.info("About to update MarketConfig: " + config);
log.info("About to update MarketConfig: {}", config);

if (!marketConfigs.isEmpty()) {

Expand All @@ -133,18 +133,19 @@ public MarketConfig save(MarketConfig config) {
.collect(Collectors.toList()));
} else {
log.warn(
"Trying to update MarketConfig but id does not exist MarketConfig: "
+ config
"Trying to update MarketConfig but id does not exist MarketConfig: {}"
+ EXISTING_MARKET_CONFIG
+ marketsType.getMarkets());
+ "{}",
config,
marketsType.getMarkets());
return null;
}
}
}

@Override
public MarketConfig delete(String id) {
log.info("Deleting Market config for id: " + id);
log.info("Deleting Market config for id: {}", id);

final MarketsType marketsType =
configurationManager.loadConfig(MarketsType.class, MARKETS_CONFIG_YAML_FILENAME);
Expand All @@ -162,10 +163,11 @@ public MarketConfig delete(String id) {
return adaptInternalToExternalConfig(Collections.singletonList(marketToRemove));
} else {
log.warn(
"Trying to delete MarketConfig but id does not exist. MarketConfig id: "
+ id
"Trying to delete MarketConfig but id does not exist. MarketConfig id: {}"
+ EXISTING_MARKET_CONFIG
+ marketsType.getMarkets());
+ "{}",
id,
marketsType.getMarkets());
return null;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public List<StrategyConfig> findAll() {

@Override
public StrategyConfig findById(String id) {
log.info("Fetching config for Strategy id: " + id);
log.info("Fetching config for Strategy id: {}", id);

final StrategiesType strategiesType =
configurationManager.loadConfig(StrategiesType.class, STRATEGIES_CONFIG_YAML_FILENAME);
Expand All @@ -92,7 +92,7 @@ public StrategyConfig save(StrategyConfig config) {
.toList();

if (config.getId() == null || config.getId().isEmpty()) {
log.info("About to create StrategyConfig: " + config);
log.info("About to create StrategyConfig: {}", config);
if (strategyConfigs.isEmpty()) {

final StrategyConfig newStrategyConfig = new StrategyConfig(config);
Expand All @@ -112,7 +112,7 @@ public StrategyConfig save(StrategyConfig config) {
+ strategiesType.getStrategies());
}
} else {
log.info("About to update StrategyConfig: " + config);
log.info("About to update StrategyConfig: {}", config);

if (!strategyConfigs.isEmpty()) {
strategiesType
Expand All @@ -132,18 +132,17 @@ public StrategyConfig save(StrategyConfig config) {
.collect(Collectors.toList()));
} else {
log.warn(
"Trying to update StrategyConfig but id does not exist StrategyConfig: "
+ config
+ " Existing StrategyConfig: "
+ strategiesType.getStrategies());
"Trying to update StrategyConfig but id does not exist StrategyConfig: {} Existing StrategyConfig: {}",
config,
strategiesType.getStrategies());
return null;
}
}
}

@Override
public StrategyConfig delete(String id) {
log.info("Deleting Strategy config for id: " + id);
log.info("Deleting Strategy config for id: {}", id);

final StrategiesType strategiesType =
configurationManager.loadConfig(StrategiesType.class, STRATEGIES_CONFIG_YAML_FILENAME);
Expand All @@ -162,10 +161,9 @@ public StrategyConfig delete(String id) {
return adaptInternalToExternalConfig(Collections.singletonList(strategyToRemove));
} else {
log.warn(
"Trying to delete StrategyConfig but id does not exist. StrategyConfig id: "
+ id
+ " Existing StrategyConfig: "
+ strategiesType.getStrategies());
"Trying to delete StrategyConfig but id does not exist. StrategyConfig id: {} Existing StrategyConfig: {}",
id,
strategiesType.getStrategies());
return null;
}
}
Expand Down

0 comments on commit 4b2dc6f

Please sign in to comment.