improves report logging

This commit is contained in:
Christian Müller
2017-09-21 01:29:17 +02:00
parent 5a8de5575b
commit 1f867a8208
+5 -3
View File
@@ -151,11 +151,13 @@ func main() {
})
e.POST("/:id/report", func(c echo.Context) error {
if legitAccess(c) {
err := email(c.Param("id"), c.FormValue("report"))
if err != nil {
report := c.FormValue("report")
if legitAccess(c) && report != "" {
id := c.Param("id")
if err := email(id, report); err != nil {
c.Logger().Errorf("couldn't send email: %v", err)
}
c.Logger().Debugf("note %s was reported", id)
}
return c.NoContent(http.StatusNoContent)
})