aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorChristine Dodrill <me@christine.website>2018-08-22 03:21:09 +0000
committerChristine Dodrill <me@christine.website>2018-08-22 03:21:09 +0000
commit66902783a1d1a83e88044ad7a1d8709003f5b6eb (patch)
tree121621be2c9ee3142dc5dfc55fd92b93c95a423f /cmd
parent6b7d6dcc49c6cbd83af70d97d01b700c8fb0c393 (diff)
downloadxesite-66902783a1d1a83e88044ad7a1d8709003f5b6eb.tar.xz
xesite-66902783a1d1a83e88044ad7a1d8709003f5b6eb.zip
logging i guess
Diffstat (limited to 'cmd')
-rw-r--r--cmd/site/html.go5
-rw-r--r--cmd/site/main.go5
2 files changed, 8 insertions, 2 deletions
diff --git a/cmd/site/html.go b/cmd/site/html.go
index 20be7de..036c854 100644
--- a/cmd/site/html.go
+++ b/cmd/site/html.go
@@ -73,10 +73,13 @@ func (s *Site) showPost(w http.ResponseWriter, r *http.Request) {
s.renderTemplatePage("blogpost.html", p).ServeHTTP(w, r)
if s.segment != nil {
- s.segment.Enqueue(&analytics.Track{
+ err := s.segment.Enqueue(&analytics.Track{
UserId: Hash(r.RemoteAddr, r.Header.Get("X-Forwarded-For")),
Event: "Post Viewed",
Properties: analytics.NewProperties().SetURL(r.RequestURI).SetTitle(p.Title),
})
+ if err != nil {
+ ln.Error(r.Context(), err)
+ }
}
}
diff --git a/cmd/site/main.go b/cmd/site/main.go
index 7dbe9bc..4da5aa0 100644
--- a/cmd/site/main.go
+++ b/cmd/site/main.go
@@ -59,11 +59,14 @@ func (s *Site) ServeHTTP(w http.ResponseWriter, r *http.Request) {
if s.segment != nil {
if !strings.HasPrefix(r.RequestURI, "/blog/") {
- s.segment.Enqueue(&analytics.Track{
+ err := s.segment.Enqueue(&analytics.Track{
UserId: Hash(r.RemoteAddr, r.Header.Get("X-Forwarded-For")),
Event: "Page Viewed",
Properties: analytics.NewProperties().SetURL(r.RequestURI),
})
+ if err != nil {
+ ln.Error(r.Context(), err)
+ }
}
}
}