Skip to content

Commit

Permalink
log datetime
Browse files Browse the repository at this point in the history
  • Loading branch information
Immueggpain authored and Immueggpain committed Aug 27, 2018
1 parent 1a8b95f commit 9143632
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
8 changes: 8 additions & 0 deletions src/main/java/com/github/immueggpain/common/sct.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ public static String datetime(long time_ms, String pattern, TimeZone timeZone) {
return datetime;
}

/**
* {@link #datetime(long, String, TimeZone) datetime(now, "yyyy-MM-dd HH:mm:ss",
* TimeZone.getDefault())}
*/
public static String datetime() {
return datetime(time_ms(), "yyyy-MM-dd HH:mm:ss", TimeZone.getDefault());
}

/**
* {@link #datetime(long, String, TimeZone) datetime(time_ms,
* "yyyy-MM-dd-HH-mm-ss-SSSXX", TimeZone.getDefault())}
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/com/github/immueggpain/smartproxy/Smartproxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -757,8 +757,8 @@ private Socket create_connect_config_socket(InetSocketAddress dest_sockaddr, Str
if (dest_sockaddr.isUnresolved()) {
nextNode = domain_to_nn.get(dest_sockaddr.getHostString());
if (nextNode != null) {
log.println(
String.format("%-7s: %-6s <- %s", client_protocol, nextNode, dest_sockaddr.getHostString()));
log.println(String.format("%s %-7s: %-6s <- %s", sct.datetime(), client_protocol, nextNode,
dest_sockaddr.getHostString()));
} else {
String intermediate = "." + dest_sockaddr.getHostString();
while (true) {
Expand All @@ -772,11 +772,11 @@ private Socket create_connect_config_socket(InetSocketAddress dest_sockaddr, Str
}
if (nextNode == null) {
nextNode = nn_proxy;
log.println(String.format("%-7s: %-6s <- default <- %s", client_protocol, nextNode,
dest_sockaddr.getHostString()));
log.println(String.format("%s %-7s: %-6s <- default <- %s", sct.datetime(), client_protocol,
nextNode, dest_sockaddr.getHostString()));
} else {
log.println(String.format("%-7s: %-6s <- %s <- %s", client_protocol, nextNode, intermediate,
dest_sockaddr.getHostString()));
log.println(String.format("%s %-7s: %-6s <- %s <- %s", sct.datetime(), client_protocol, nextNode,
intermediate, dest_sockaddr.getHostString()));
}
}
} else {
Expand Down

0 comments on commit 9143632

Please sign in to comment.