logging improved
This commit is contained in:
@@ -140,7 +140,7 @@ func main() {
|
|||||||
c.Logger().Errorf("POST /note error: %d", code)
|
c.Logger().Errorf("POST /note error: %d", code)
|
||||||
return c.Render(code, "Note", responsePage(code, err.Error()))
|
return c.Render(code, "Note", responsePage(code, err.Error()))
|
||||||
}
|
}
|
||||||
c.Logger().Debugf("note %s saved", n.ID)
|
c.Logger().Infof("note %s saved", n.ID)
|
||||||
return c.Redirect(http.StatusMovedPermanently, "/"+n.ID)
|
return c.Redirect(http.StatusMovedPermanently, "/"+n.ID)
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -194,7 +194,7 @@ func checkRecaptcha(c echo.Context, captchaResp string) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if !respJson.Success {
|
if !respJson.Success {
|
||||||
c.Logger().Errorf("captcha response validation failed: %v", respJson.ErrorCodes)
|
c.Logger().Warnf("captcha validation failed: %v", respJson.ErrorCodes)
|
||||||
}
|
}
|
||||||
return respJson.Success
|
return respJson.Success
|
||||||
|
|
||||||
|
|||||||
@@ -124,7 +124,6 @@ func load(c echo.Context, db *sql.DB) (*Note, int) {
|
|||||||
var editedVal interface{}
|
var editedVal interface{}
|
||||||
var views int
|
var views int
|
||||||
if err := row.Scan(&id, &text, &published, &editedVal, &password, &views); err != nil {
|
if err := row.Scan(&id, &text, &published, &editedVal, &password, &views); err != nil {
|
||||||
c.Logger().Error(err)
|
|
||||||
code := http.StatusNotFound
|
code := http.StatusNotFound
|
||||||
return responsePage(code), code
|
return responsePage(code), code
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user