Some logging refactoring.

Fixes #14.
This commit is contained in:
2020-02-29 23:30:44 +05:00
parent 5f58741159
commit 825fd724ff
9 changed files with 43 additions and 47 deletions

View File

@@ -142,7 +142,7 @@ func pastePOSTWebInterface(ec echo.Context) error {
}
newPasteIDAsString := strconv.FormatInt(id, 10)
c.Logger.Debug().Msgf("Paste saved, URL: /paste/" + newPasteIDAsString)
c.Logger.Debug().Msg("Paste saved, URL: /paste/" + newPasteIDAsString)
// Private pastes have it's timestamp in URL.
if paste.Private {

View File

@@ -60,7 +60,7 @@ func pastesGET(ec echo.Context) error {
// Get pastes IDs.
pastes, err3 := c.Database.GetPagedPastes(page)
c.Logger.Debug().Msgf("Got %d pastes", len(pastes))
c.Logger.Debug().Int("count", len(pastes)).Msg("Got pastes")
var pastesString = "No pastes to show."
@@ -102,7 +102,7 @@ func pastesGET(ec echo.Context) error {
// Pagination.
pages := c.Database.GetPastesPages()
c.Logger.Debug().Msgf("Total pages: %d, current: %d", pages, page)
c.Logger.Debug().Int("total pages", pages).Int("current page", page).Msg("Paging data")
paginationHTML := pagination.CreateHTML(page, pages, "/pastes/")
pasteListTpl := templater.GetTemplate(ec, "pastelist_list.html", map[string]string{"pastes": pastesString, "pagination": paginationHTML})