[MM-55595] Use annotated logger in search layer (#25468)

Этот коммит содержится в:
Ben Schumacher
2023-12-04 18:34:57 +01:00
коммит произвёл GitHub
родитель 5a4dba8809
Коммит b2ec1ff8ae
130 изменённых файлов: 2107 добавлений и 1930 удалений

Просмотреть файл

@@ -14,6 +14,7 @@ import (
"github.com/pkg/errors"
"github.com/mattermost/mattermost/server/public/model"
"github.com/mattermost/mattermost/server/public/shared/mlog"
"github.com/mattermost/mattermost/server/v8/channels/store"
"github.com/mattermost/mattermost/server/v8/channels/store/searchlayer"
"github.com/mattermost/mattermost/server/v8/channels/store/sqlstore"
@@ -28,6 +29,7 @@ type MainHelper struct {
SearchEngine *searchengine.Broker
SQLStore *sqlstore.SqlStore
ClusterInterface *FakeClusterInterface
Logger *mlog.Logger
status int
testResourcePath string
@@ -64,7 +66,13 @@ func NewMainHelperWithOptions(options *HelperOptions) *MainHelper {
os.Unsetenv("MM_SERVICESETTINGS_CONNECTIONSECURITY")
os.Unsetenv("MM_SERVICESETTINGS_ENABLEDEVELOPER")
var mainHelper MainHelper
logger := mlog.CreateConsoleLogger()
mainHelper := MainHelper{
Logger: logger,
}
mlog.NewLogger()
flag.Parse()
utils.TranslationsPreInit()
@@ -83,6 +91,7 @@ func NewMainHelperWithOptions(options *HelperOptions) *MainHelper {
}
func (h *MainHelper) Main(m *testing.M) {
defer h.Logger.Shutdown()
if h.testResourcePath != "" {
prevDir, err := os.Getwd()
if err != nil {
@@ -121,7 +130,7 @@ func (h *MainHelper) setupStore(withReadReplica bool) {
h.ClusterInterface = &FakeClusterInterface{}
var err error
h.SQLStore, err = sqlstore.New(*h.Settings, nil)
h.SQLStore, err = sqlstore.New(*h.Settings, h.Logger, nil)
if err != nil {
panic(err)
}
@@ -138,7 +147,7 @@ func (h *MainHelper) ToggleReplicasOff() {
lic := h.SQLStore.GetLicense()
var err error
h.SQLStore, err = sqlstore.New(*h.Settings, nil)
h.SQLStore, err = sqlstore.New(*h.Settings, h.Logger, nil)
if err != nil {
panic(err)
}
@@ -153,7 +162,7 @@ func (h *MainHelper) ToggleReplicasOn() {
lic := h.SQLStore.GetLicense()
var err error
h.SQLStore, err = sqlstore.New(*h.Settings, nil)
h.SQLStore, err = sqlstore.New(*h.Settings, h.Logger, nil)
if err != nil {
panic(err)
}