Skip to content

Commit

Permalink
Added logging to editCLI
Browse files Browse the repository at this point in the history
  • Loading branch information
dennis guye committed Aug 12, 2019
1 parent 6225e15 commit ae96a93
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions modAionImpl/src/org/aion/zero/impl/cli/EditCli.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ public class EditCli {
private boolean updatePort(CfgNetP2p net) {
if (port != null && net.getPort() != port) {
net.setPort(port);
System.out.println("Updated p2p port to: " + port);
return true;
} else {
return false;
Expand All @@ -103,22 +104,28 @@ private boolean updatePort(CfgNetP2p net) {
private boolean updatePrune(CfgDb cfgDb) {
if (pruneOption != null && !pruneOption.equals(cfgDb.getPrune_option())) {
cfgDb.setPrune_option(pruneOption);
System.out.println("Updated state storage to: " + pruneOption.toString().toLowerCase());
return true;
} else return false;
}

private boolean updateVendor(CfgDb cfgDb) {
if (vendor != null && !vendor.equals(DBVendor.fromString(cfgDb.getVendor()))) {
cfgDb.setVendor(vendor.name());
System.out.println("Updated database vendor to: " + vendor.toString().toLowerCase());
return true;
} else {
return false;
}
}
private static String boolToMessage(boolean bool){
return bool? "Enabled":"Disabled";
}

private boolean updateJavaApi(CfgApiZmq cfgApiZmq) {
if (javaApi !=null && javaApi != cfgApiZmq.getActive()) {
cfgApiZmq.setActive(javaApi);
System.out.println(boolToMessage(javaApi) + " java api.");
return true;
} else {
return false;
Expand All @@ -128,6 +135,7 @@ private boolean updateJavaApi(CfgApiZmq cfgApiZmq) {
private boolean updateJsonRPC(CfgApiRpc cfgApiRpc) {
if (jsonRPC != null && jsonRPC != cfgApiRpc.isActive()) {
cfgApiRpc.setActive(jsonRPC);
System.out.println(boolToMessage(jsonRPC) + " jsonRPC.");
return true;
} else {
return false;
Expand All @@ -137,6 +145,7 @@ private boolean updateJsonRPC(CfgApiRpc cfgApiRpc) {
private boolean updateMining(CfgConsensus cfgConsensus) {
if (cfgConsensus instanceof CfgConsensusPow) {
if (mining != null && mining != ((CfgConsensusPow) cfgConsensus).getMining()) {
System.out.println(boolToMessage(mining) + " mining.");

((CfgConsensusPow) cfgConsensus).setMining(mining);
return true;
Expand All @@ -148,6 +157,7 @@ private boolean updateMining(CfgConsensus cfgConsensus) {

private boolean updateStatus(CfgSync cfgSync) {
if (showStatus != null && cfgSync.getShowStatus() != showStatus) {
System.out.println((showStatus ? "Showing" : "Hiding") + " sync status.");
cfgSync.setShowStatus(showStatus);
return true;
} else {
Expand All @@ -158,6 +168,7 @@ private boolean updateStatus(CfgSync cfgSync) {
private boolean updateCompression(CfgDb cfgDb) {
if (compression != null && cfgDb.isCompression() != compression) {
cfgDb.setCompression(compression);
System.out.println(boolToMessage(compression) + " database compression.");
return true;
} else {
return false;
Expand All @@ -170,6 +181,7 @@ private boolean updateLog(CfgLog cfgLog) {
for (Object[] objects : log) {

if (cfgLog.updateModule(((LogEnum) objects[0]).name().toLowerCase(), ((LogLevel) objects[1]).name())) {
System.out.println("Changed loglevel of "+objects[0].toString().toLowerCase() +" logger to " + objects[1].toString() );
res = true;
}
}
Expand Down

0 comments on commit ae96a93

Please sign in to comment.