Adding structuredLogging check and fix inconsistencies (#13370)
* Adding structuredLogging check and fix inconsistencies * Addressing PR review comments * Addressing PR review comments * Addressing PR review comments * Addressing PR review comments * Addressing PR review comments
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
fd0a3a687d
Коммит
b8ef62e502
@@ -4,7 +4,6 @@
|
||||
package wsapi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/mattermost/mattermost-server/v5/app"
|
||||
@@ -23,11 +22,18 @@ type webSocketHandler struct {
|
||||
}
|
||||
|
||||
func (wh webSocketHandler) ServeWebSocket(conn *app.WebConn, r *model.WebSocketRequest) {
|
||||
mlog.Debug(fmt.Sprintf("websocket: %s", r.Action))
|
||||
mlog.Debug("Websocket request", mlog.String("action", r.Action))
|
||||
|
||||
session, sessionErr := wh.app.GetSession(conn.GetSessionToken())
|
||||
if sessionErr != nil {
|
||||
mlog.Error(fmt.Sprintf("%v:%v seq=%v uid=%v %v [details: %v]", "websocket", r.Action, r.Seq, conn.UserId, sessionErr.SystemMessage(utils.T), sessionErr.Error()))
|
||||
mlog.Error(
|
||||
"websocket session error",
|
||||
mlog.String("action", r.Action),
|
||||
mlog.Int64("seq", r.Seq),
|
||||
mlog.String("user_id", conn.UserId),
|
||||
mlog.String("error_message", sessionErr.SystemMessage(utils.T)),
|
||||
mlog.Err(sessionErr),
|
||||
)
|
||||
sessionErr.DetailedError = ""
|
||||
errResp := model.NewWebSocketError(r.Seq, sessionErr)
|
||||
|
||||
@@ -43,7 +49,14 @@ func (wh webSocketHandler) ServeWebSocket(conn *app.WebConn, r *model.WebSocketR
|
||||
var err *model.AppError
|
||||
|
||||
if data, err = wh.handlerFunc(r); err != nil {
|
||||
mlog.Error(fmt.Sprintf("%v:%v seq=%v uid=%v %v [details: %v]", "websocket", r.Action, r.Seq, r.Session.UserId, err.SystemMessage(utils.T), err.DetailedError))
|
||||
mlog.Error(
|
||||
"websocket request handling error",
|
||||
mlog.String("action", r.Action),
|
||||
mlog.Int64("seq", r.Seq),
|
||||
mlog.String("user_id", conn.UserId),
|
||||
mlog.String("error_message", err.SystemMessage(utils.T)),
|
||||
mlog.Err(err),
|
||||
)
|
||||
err.DetailedError = ""
|
||||
errResp := model.NewWebSocketError(r.Seq, err)
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user