Browse Source

switch to primary
print json data

Martin Kunz 5 years ago
parent
commit
b1a030c279

+ 1 - 1
src/main/java/at/acdp/urweb/Main.java

@@ -8,7 +8,7 @@ import java.io.IOException;
 public class Main {
 
     public static void main(String [ ] args) {
-        ScReadThread rt=new ScReadThread("192.168.20.159");
+        ScReadThread rt=new ScReadThread("127.0.0.1");
         new WebServer(8080,true, rt).start();
         Thread t=new Thread(rt);
         t.start();

+ 1 - 1
src/main/java/at/acdp/urweb/ScReadThread.java

@@ -34,7 +34,7 @@ public class ScReadThread implements Runnable {
     }
 
     private void read() throws IOException {
-        rde=new SecondaryClient(ip, 30002);
+        rde=new SecondaryClient(ip, 30001);
         VersionMessage vm = rde.connect();
         while(true) {
             rde.readPackage();

+ 5 - 4
webroot/index.html

@@ -17,7 +17,7 @@
 
     <ul id="loglist">
         <li v-for="(item, index) in log.slice().reverse()">
-            {{ index }} - {{ item.entry.message }} -  {{ ts2txt(item.ts) }}
+            {{ ts2txt(item.ts) }} - {{ item.entry.message }} - <pre>{{ JSON.stringify(item.entry) }}</pre>
         </li>
     </ul>
 </div>
@@ -47,7 +47,7 @@
                     });
             },
             ts2txt: function (ts) {
-                return moment(ts).format('YYYY-MM-DD [at] hh:mm')
+                return moment(ts).format('YYYY-MM-DD hh:mm ss.SSS ')
             },
             update: function (event) {
                 fetch('/log/'+this.lastID, {method: "GET"})
@@ -59,13 +59,14 @@
                         console.log(JSON.stringify(myJson));
                         this.$data.log=this.$data.log.concat(myJson.entries);
                         this.$data.lastID=myJson.lastID;
+                        let len=this.$data.log.length;
+                        this.$data.log.splice(0,len-200);
                     })
                     .catch(error => {
-                        this.$data.lastID=0;3
+                        this.$data.lastID=0;
                         this.$data.log=[];
                         console.log(error)
                     } );
-
             }
         }
     })