From 32328a5a9b3f9e1318b71f4acb0a3510e0767288 Mon Sep 17 00:00:00 2001 From: Peter Stuifzand Date: Tue, 30 Jun 2020 19:50:12 +0200 Subject: [PATCH] Tracking times of saving pages --- file.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/file.go b/file.go index 3c1640c..e0e6c11 100644 --- a/file.go +++ b/file.go @@ -8,6 +8,7 @@ import ( "html" "html/template" "io/ioutil" + "log" "os" "os/exec" "path/filepath" @@ -85,6 +86,13 @@ func (fp *FilePages) Save(p string, page Page, summary, author string) error { } func (fp *FilePages) save(msg saveMessage) error { + startTime := time.Now() + defer func() { + endTime := time.Now() + d := endTime.Sub(startTime) + log.Printf("Page saved in %s\n", d.String()) + }() + p := msg.p page := msg.page summary := msg.summary @@ -119,7 +127,7 @@ func (fp *FilePages) save(msg saveMessage) error { if err != nil { return err } - // err = saveDocuments(fp) + err = saveDocuments(fp) err = saveLinks(fp) return err } @@ -148,6 +156,7 @@ func saveLinks(fp *FilePages) error { } return nil } + func saveDocuments(fp *FilePages) error { type Document struct { Title string `json:"title"`