feat: update logs

optimize logs in NodeCenterClientController; reformat CMHttpServer
This commit is contained in:
Frank.R.Wu 2021-12-11 22:29:24 +08:00
parent 55d7453ab6
commit 33f8bda665
2 changed files with 8 additions and 11 deletions

View File

@ -156,8 +156,9 @@ public class CMHttpServer {
} }
private static String[] parseStrAsList(String str) { private static String[] parseStrAsList(String str) {
if (str == null) if (str == null) {
return new String[]{}; return new String[]{};
}
return str.split(","); return str.split(",");
} }

View File

@ -383,22 +383,18 @@ public class NodeCenterClientController implements NodeCenterConn {
jo.get("pubKey").getAsString(), jo.get("masterAddress").getAsString()); jo.get("pubKey").getAsString(), jo.get("masterAddress").getAsString());
NetworkManager.instance.connectToAgent(jo.get("pubKey").getAsString(), null); NetworkManager.instance.connectToAgent(jo.get("pubKey").getAsString(), null);
LOGGER.info( LOGGER.info(
"[CMClientController] " String.format("the master of contract %s: pubKey=%s address=%s",
+ contractID contractID,
+ " 查询master结果为 pubKey=" jo.get("pubKey").getAsString(),
+ jo.get("pubKey").getAsString() jo.get("masterAddress").getAsString()));
+ " 地址为"
+ jo.get("masterAddress").getAsString());
contractID2PubKey.put(contractID, jo.get("pubKey").getAsString()); contractID2PubKey.put(contractID, jo.get("pubKey").getAsString());
return jo.get("pubKey").getAsString(); return jo.get("pubKey").getAsString();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); LOGGER.warn("the master of contract " + contractID + " is null! " + e.getMessage());
LOGGER.info("[CMClientController] " + contractID + " 查询master结果为 null");
} }
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); LOGGER.warn("the master of contract " + contractID + " is null! " + e.getMessage());
LOGGER.info("[CMClientController] " + contractID + " 查询master结果为 null");
} }
return null; return null;
} }