aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2016-10-09 11:45:08 +0200
committerDmitry Vyukov <dvyukov@google.com>2016-10-09 11:45:08 +0200
commitfa1e150738298ef5e8e22de8b82f6835a227bdf8 (patch)
tree2d85f6ccec276669bbcded0ba65eeb72eefd4096
parentd3ccb39592f8ffe40b000e7c830f87d3778badd7 (diff)
syz-gce: show cached log in web ui
-rw-r--r--syz-gce/http.go23
-rw-r--r--syz-gce/syz-gce.go1
2 files changed, 22 insertions, 2 deletions
diff --git a/syz-gce/http.go b/syz-gce/http.go
index b0841cd80..de63b411c 100644
--- a/syz-gce/http.go
+++ b/syz-gce/http.go
@@ -27,7 +27,10 @@ func initHttp(addr string) {
}
func httpSummary(w http.ResponseWriter, r *http.Request) {
- if err := summaryTemplate.Execute(w, nil); err != nil {
+ data := &UISummaryData{
+ Log: CachedLogOutput(),
+ }
+ if err := summaryTemplate.Execute(w, data); err != nil {
http.Error(w, fmt.Sprintf("failed to execute template: %v", err), http.StatusInternalServerError)
return
}
@@ -37,6 +40,10 @@ func compileTemplate(html string) *template.Template {
return template.Must(template.New("").Parse(strings.Replace(html, "{{STYLE}}", htmlStyle, -1)))
}
+type UISummaryData struct {
+ Log string
+}
+
var summaryTemplate = compileTemplate(`
<!doctype html>
<html>
@@ -45,7 +52,16 @@ var summaryTemplate = compileTemplate(`
{{STYLE}}
</head>
<body>
-syz-gce
+<b>syz-gce</b>
+<br>
+<br>
+
+Log:
+<br>
+<textarea readonly rows="50">
+{{.Log}}
+</textarea>
+
</body></html>
`)
@@ -58,5 +74,8 @@ const htmlStyle = `
table td {
border:1px solid;
}
+ textarea {
+ width:100%;
+ }
</style>
`
diff --git a/syz-gce/syz-gce.go b/syz-gce/syz-gce.go
index c44cbf7ae..48a40565e 100644
--- a/syz-gce/syz-gce.go
+++ b/syz-gce/syz-gce.go
@@ -49,6 +49,7 @@ type Config struct {
func main() {
flag.Parse()
cfg = readConfig(*flagConfig)
+ EnableLogCaching(1000, 1<<20)
initHttp(fmt.Sprintf(":%v", cfg.Http_Port))
gopath, err := filepath.Abs("gopath")