time in log from remote server
authorNiki Roo <niki@nikiroo.be>
Sun, 12 May 2019 16:26:29 +0000 (18:26 +0200)
committerNiki Roo <niki@nikiroo.be>
Sun, 12 May 2019 16:26:29 +0000 (18:26 +0200)
src/be/nikiroo/fanfix/library/RemoteLibraryServer.java

index c3933ebb276c65e171546109c59d6daa96df8501..f88b25ae5a3d335938fba59b0c3a24fea6afb8f9 100644 (file)
@@ -142,7 +142,8 @@ public class RemoteLibraryServer extends ServerObject {
                for (Object arg : args) {
                        trace += arg + " ";
                }
-               System.out.println(trace);
+               long now = System.currentTimeMillis();
+               System.out.println(StringUtils.fromTime(now) + ": " + trace);
 
                Object rep = null;
                try {
@@ -180,9 +181,12 @@ public class RemoteLibraryServer extends ServerObject {
 
                String rec = StringUtils.formatNumber(bytesReceived) + "b";
                String sent = StringUtils.formatNumber(bytesSent) + "b";
-               System.out.println(String.format("%s[>%s]: (%s sent, %s rec) in %d ms",
-                               display(whitelist, rw), commands.get(id), sent, rec,
-                               times.get(id)));
+               long now = System.currentTimeMillis();
+               System.out.println(StringUtils.fromTime(now)
+                               + ": "
+                               + String.format("%s[>%s]: (%s sent, %s rec) in %d ms",
+                                               display(whitelist, rw), commands.get(id), sent, rec,
+                                               times.get(id)));
 
                commands.remove(id);
                times.remove(id);
@@ -347,7 +351,9 @@ public class RemoteLibraryServer extends ServerObject {
        @Override
        protected void onError(Exception e) {
                if (e instanceof SSLException) {
-                       System.out.println("[Client connection refused (bad key)]");
+                       long now = System.currentTimeMillis();
+                       System.out.println(StringUtils.fromTime(now) + ": "
+                                       + "[Client connection refused (bad key)]");
                } else {
                        getTraceHandler().error(e);
                }