From fa1e150738298ef5e8e22de8b82f6835a227bdf8 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Sun, 9 Oct 2016 11:45:08 +0200 Subject: syz-gce: show cached log in web ui --- syz-gce/http.go | 23 +++++++++++++++++++++-- syz-gce/syz-gce.go | 1 + 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(` @@ -45,7 +52,16 @@ var summaryTemplate = compileTemplate(` {{STYLE}} -syz-gce +syz-gce +
+
+ +Log: +
+ + `) @@ -58,5 +74,8 @@ const htmlStyle = ` table td { border:1px solid; } + textarea { + width:100%; + } ` 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") -- cgit mrf-deployment