12345678910111213141516171819202122232425262728293031323334353637 |
- package authlogger
- import (
- "encoding/json"
- "net/http"
- )
- //Handle of listing of the logger index (months)
- func (l *Logger) HandleIndexListing(w http.ResponseWriter, r *http.Request) {
- indexes := l.ListSummary()
- js, err := json.Marshal(indexes)
- if err != nil {
- sendErrorResponse(w, err.Error())
- return
- }
- sendJSONResponse(w, string(js))
- }
- //Handle of the listing of a given index (month)
- func (l *Logger) HandleTableListing(w http.ResponseWriter, r *http.Request) {
- //Get the record name request for listing
- month, err := mv(r, "record", true)
- if err != nil {
- sendErrorResponse(w, err.Error())
- return
- }
- records, err := l.ListRecords(month)
- if err != nil {
- sendErrorResponse(w, err.Error())
- return
- }
- js, _ := json.Marshal(records)
- sendJSONResponse(w, string(js))
- }
|