1
0
mirror of https://github.com/mattermost/focalboard.git synced 2025-07-15 23:54:29 +02:00

Logger for FocalBoard server (#466)

- structured, asynchronous logging
- supports discreet log levels, including custom levels
- supports output to console, files, and all common log aggregators.
- supports JSON, plain text and GELF formats
- lazy formatting and writing
This commit is contained in:
Doug Lauder
2021-05-29 02:23:10 -04:00
committed by GitHub
parent fe6b0d04b3
commit 417de9f837
29 changed files with 1150 additions and 275 deletions

View File

@ -3,11 +3,11 @@ package api
import (
"encoding/json"
"io/ioutil"
"log"
"net/http"
"strings"
"github.com/gorilla/mux"
"github.com/mattermost/focalboard/server/services/mlog"
)
type AdminSetPasswordData struct {
@ -20,29 +20,29 @@ func (a *API) handleAdminSetPassword(w http.ResponseWriter, r *http.Request) {
requestBody, err := ioutil.ReadAll(r.Body)
if err != nil {
errorResponse(w, http.StatusInternalServerError, "", err)
a.errorResponse(w, http.StatusInternalServerError, "", err)
return
}
var requestData AdminSetPasswordData
err = json.Unmarshal(requestBody, &requestData)
if err != nil {
errorResponse(w, http.StatusInternalServerError, "", err)
a.errorResponse(w, http.StatusInternalServerError, "", err)
return
}
if !strings.Contains(requestData.Password, "") {
errorResponse(w, http.StatusBadRequest, "password is required", err)
a.errorResponse(w, http.StatusBadRequest, "password is required", err)
return
}
err = a.app().UpdateUserPassword(username, requestData.Password)
if err != nil {
errorResponse(w, http.StatusInternalServerError, "", err)
a.errorResponse(w, http.StatusInternalServerError, "", err)
return
}
log.Printf("AdminSetPassword, username: %s", username)
a.logger.Debug("AdminSetPassword, username: %s", mlog.String("username", username))
jsonStringResponse(w, http.StatusOK, "{}")
}