cleanup log levels (#2824)
This commit is contained in:
parent
62b2abc3d2
commit
b47e70579b
7 changed files with 21 additions and 10 deletions
|
@ -1638,7 +1638,7 @@ func (a *API) handlePostSharing(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if !a.app.GetClientConfig().EnablePublicSharedBoards {
|
if !a.app.GetClientConfig().EnablePublicSharedBoards {
|
||||||
a.logger.Info(
|
a.logger.Warn(
|
||||||
"Attempt to turn on sharing for board via API failed, sharing off in configuration.",
|
"Attempt to turn on sharing for board via API failed, sharing off in configuration.",
|
||||||
mlog.String("boardID", sharing.ID),
|
mlog.String("boardID", sharing.ID),
|
||||||
mlog.String("userID", userID))
|
mlog.String("userID", userID))
|
||||||
|
@ -4102,7 +4102,7 @@ func (a *API) handleDeleteBoardsAndBlocks(w http.ResponseWriter, r *http.Request
|
||||||
// Response helpers
|
// Response helpers
|
||||||
|
|
||||||
func (a *API) errorResponse(w http.ResponseWriter, api string, code int, message string, sourceError error) {
|
func (a *API) errorResponse(w http.ResponseWriter, api string, code int, message string, sourceError error) {
|
||||||
if code == http.StatusUnauthorized {
|
if code == http.StatusUnauthorized || code == http.StatusForbidden {
|
||||||
a.logger.Debug("API DEBUG",
|
a.logger.Debug("API DEBUG",
|
||||||
mlog.Int("code", code),
|
mlog.Int("code", code),
|
||||||
mlog.Err(sourceError),
|
mlog.Err(sourceError),
|
||||||
|
|
|
@ -80,7 +80,7 @@ func (a *App) ImportArchive(r io.Reader, opt model.ImportArchiveOptions) error {
|
||||||
// import file/image; dir is the old board id
|
// import file/image; dir is the old board id
|
||||||
boardID, ok := boardMap[dir]
|
boardID, ok := boardMap[dir]
|
||||||
if !ok {
|
if !ok {
|
||||||
a.logger.Error("skipping orphan image in archive",
|
a.logger.Warn("skipping orphan image in archive",
|
||||||
mlog.String("dir", dir),
|
mlog.String("dir", dir),
|
||||||
mlog.String("filename", filename),
|
mlog.String("filename", filename),
|
||||||
)
|
)
|
||||||
|
|
|
@ -198,7 +198,7 @@ func (s *MattermostAuthLayer) GetTeam(id string) (*model.Team, error) {
|
||||||
row := query.QueryRow()
|
row := query.QueryRow()
|
||||||
var displayName string
|
var displayName string
|
||||||
err := row.Scan(&displayName)
|
err := row.Scan(&displayName)
|
||||||
if err != nil {
|
if err != nil && !s.IsErrNotFound(err) {
|
||||||
s.logger.Error("GetTeam scan error",
|
s.logger.Error("GetTeam scan error",
|
||||||
mlog.String("team_id", id),
|
mlog.String("team_id", id),
|
||||||
mlog.Err(err),
|
mlog.Err(err),
|
||||||
|
|
|
@ -292,7 +292,7 @@ func (s *SQLStore) insertBoard(db sq.BaseRunner, board *model.Board, userID stri
|
||||||
}
|
}
|
||||||
|
|
||||||
existingBoard, err := s.getBoard(db, board.ID)
|
existingBoard, err := s.getBoard(db, board.ID)
|
||||||
if err != nil && !errors.Is(err, sql.ErrNoRows) {
|
if err != nil && !s.IsErrNotFound(err) {
|
||||||
return nil, fmt.Errorf("insertBoard error occurred while fetching existing board %s: %w", board.ID, err)
|
return nil, fmt.Errorf("insertBoard error occurred while fetching existing board %s: %w", board.ID, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -490,7 +490,7 @@ func (s *SQLStore) migrateTeamLessBoards() error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
s.logger.Info(fmt.Sprintf("Migrating %d teamless boards to a team", len(boards)))
|
s.logger.Info("Migrating teamless boards to a team", mlog.Int("count", len(boards)))
|
||||||
|
|
||||||
// cache for best suitable team for a DM. Since a DM can
|
// cache for best suitable team for a DM. Since a DM can
|
||||||
// contain multiple boards, caching this avoids
|
// contain multiple boards, caching this avoids
|
||||||
|
|
|
@ -3,11 +3,13 @@
|
||||||
package store
|
package store
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"database/sql"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/mattermost/focalboard/server/model"
|
"github.com/mattermost/focalboard/server/model"
|
||||||
|
|
||||||
mmModel "github.com/mattermost/mattermost-server/v6/model"
|
mmModel "github.com/mattermost/mattermost-server/v6/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -161,6 +163,15 @@ func IsErrNotFound(err error) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check if this is a store.ErrNotFound
|
||||||
var nf *ErrNotFound
|
var nf *ErrNotFound
|
||||||
return errors.As(err, &nf)
|
if errors.As(err, &nf) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// check if this is a sql.ErrNotFound
|
||||||
|
if errors.Is(err, sql.ErrNoRows) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
|
|
@ -524,7 +524,7 @@ func (pa *PluginAdapter) BroadcastBlockDelete(teamID, blockID, boardID string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pa *PluginAdapter) BroadcastBoardChange(teamID string, board *model.Board) {
|
func (pa *PluginAdapter) BroadcastBoardChange(teamID string, board *model.Board) {
|
||||||
pa.logger.Info("BroadcastingBoardChange",
|
pa.logger.Debug("BroadcastingBoardChange",
|
||||||
mlog.String("teamID", teamID),
|
mlog.String("teamID", teamID),
|
||||||
mlog.String("boardID", board.ID),
|
mlog.String("boardID", board.ID),
|
||||||
)
|
)
|
||||||
|
@ -550,7 +550,7 @@ func (pa *PluginAdapter) BroadcastBoardDelete(teamID, boardID string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pa *PluginAdapter) BroadcastMemberChange(teamID, boardID string, member *model.BoardMember) {
|
func (pa *PluginAdapter) BroadcastMemberChange(teamID, boardID string, member *model.BoardMember) {
|
||||||
pa.logger.Info("BroadcastingMemberChange",
|
pa.logger.Debug("BroadcastingMemberChange",
|
||||||
mlog.String("teamID", teamID),
|
mlog.String("teamID", teamID),
|
||||||
mlog.String("boardID", boardID),
|
mlog.String("boardID", boardID),
|
||||||
mlog.String("userID", member.UserID),
|
mlog.String("userID", member.UserID),
|
||||||
|
@ -566,7 +566,7 @@ func (pa *PluginAdapter) BroadcastMemberChange(teamID, boardID string, member *m
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pa *PluginAdapter) BroadcastMemberDelete(teamID, boardID, userID string) {
|
func (pa *PluginAdapter) BroadcastMemberDelete(teamID, boardID, userID string) {
|
||||||
pa.logger.Info("BroadcastingMemberDelete",
|
pa.logger.Debug("BroadcastingMemberDelete",
|
||||||
mlog.String("teamID", teamID),
|
mlog.String("teamID", teamID),
|
||||||
mlog.String("boardID", boardID),
|
mlog.String("boardID", boardID),
|
||||||
mlog.String("userID", userID),
|
mlog.String("userID", userID),
|
||||||
|
|
Loading…
Reference in a new issue