1
0
mirror of https://github.com/mattermost/focalboard.git synced 2024-12-24 13:43:12 +02:00

Replace mlog with server v6 mlog (#1088)

* replace mlog with server v6 mlog
* remove FB mlog from plugin
This commit is contained in:
Doug Lauder 2021-08-25 17:08:01 -03:00 committed by GitHub
parent 791c600151
commit b58497e2ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
42 changed files with 136 additions and 524 deletions

View File

@ -7,5 +7,6 @@ replace github.com/mattermost/focalboard/server => ../server
require (
github.com/google/uuid v1.2.0
github.com/mattermost/focalboard/server v0.0.0-20210422230105-f5ae0b265a8d
github.com/mattermost/mattermost-server/v6 v6.0.0-20210824141503-6031b163d8e3
github.com/webview/webview v0.0.0-20200724072439-e0c01595b361
)

View File

@ -574,10 +574,11 @@ github.com/mattermost/ldap v0.0.0-20201202150706-ee0e6284187d h1:/RJ/UV7M5c7L2TQ
github.com/mattermost/ldap v0.0.0-20201202150706-ee0e6284187d/go.mod h1:HLbgMEI5K131jpxGazJ97AxfPDt31osq36YS1oxFQPQ=
github.com/mattermost/logr v1.0.13 h1:6F/fM3csvH6Oy5sUpJuW7YyZSzZZAhJm5VcgKMxA2P8=
github.com/mattermost/logr v1.0.13/go.mod h1:Mt4DPu1NXMe6JxPdwCC0XBoxXmN9eXOIRPoZarU2PXs=
github.com/mattermost/logr/v2 v2.0.4 h1:LiqvzNNfia23hlu1zmmCDmjqmSfwWNsEtFlL4/7jf8o=
github.com/mattermost/logr/v2 v2.0.4/go.mod h1:mpPp935r5dIkFDo2y9Q87cQWhFR/4xXpNh0k/y8Hmwg=
github.com/mattermost/mattermost-server/v6 v6.0.0-20210817091833-04b27ce93c02 h1:v2SaNLiD02UAWJVwTvDBkFTqD2GwyPaRJ3vs7yDwcpE=
github.com/mattermost/mattermost-server/v6 v6.0.0-20210817091833-04b27ce93c02/go.mod h1:lRyN5kvq4pllE0+9fGsxneaSRDszzaRISo6Z49YHg+M=
github.com/mattermost/logr/v2 v2.0.10/go.mod h1:mpPp935r5dIkFDo2y9Q87cQWhFR/4xXpNh0k/y8Hmwg=
github.com/mattermost/logr/v2 v2.0.11 h1:eGg73t/HHkirGq34S+r6geGVuuVVrHDbW26QXCog6aw=
github.com/mattermost/logr/v2 v2.0.11/go.mod h1:mpPp935r5dIkFDo2y9Q87cQWhFR/4xXpNh0k/y8Hmwg=
github.com/mattermost/mattermost-server/v6 v6.0.0-20210824141503-6031b163d8e3 h1:QTxrstPliume2trhYjv+Pl3xCkQZBPbgvrvk/F5Iscg=
github.com/mattermost/mattermost-server/v6 v6.0.0-20210824141503-6031b163d8e3/go.mod h1:+S8CsNEPv1FOl1usaPBQ6Gu9+Sm1Cc9YdU/Qh1YMGVI=
github.com/mattermost/rsc v0.0.0-20160330161541-bbaefb05eaa0/go.mod h1:nV5bfVpT//+B1RPD2JvRnxbkLmJEYXmRaaVl15fsXjs=
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ=
@ -917,7 +918,6 @@ github.com/vmihailenco/msgpack/v5 v5.3.4/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q
github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds=
github.com/webview/webview v0.0.0-20200724072439-e0c01595b361 h1:e0+/fQY5l9NdCwPsEg9S8AgE5lFhZ/6UX+b2KkpIBFg=
github.com/webview/webview v0.0.0-20200724072439-e0c01595b361/go.mod h1:rpXAuuHgyEJb6kXcXldlkOjU6y4x+YcASKKXJNUhh0Y=
github.com/wiggin77/cfg v1.0.2 h1:NBUX+iJRr+RTncTqTNvajHwzduqbhCQjEqxLHr6Fk7A=
github.com/wiggin77/cfg v1.0.2/go.mod h1:b3gotba2e5bXTqTW48DwIFoLc+4lWKP7WPi/CdvZ4aE=
github.com/wiggin77/merror v1.0.2/go.mod h1:uQTcIU0Z6jRK4OwqganPYerzQxSFJ4GSHM3aurxxQpg=
github.com/wiggin77/merror v1.0.3 h1:8+ZHV+aSnJoYghE3EUThl15C6rvF2TYRSvOSBjdmNR8=
@ -976,15 +976,12 @@ go.opentelemetry.io/otel/trace v1.0.0-RC1/go.mod h1:86UHmyHWFEtWjfWPSbu0+d0Pf9Q6
go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/atomic v1.8.0 h1:CUhrE4N1rqSE6FM9ecihEjRkLQu8cDfgDyoOs83mEY4=
go.uber.org/atomic v1.8.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
go.uber.org/multierr v1.7.0 h1:zaiO/rmgFjbmCXdSYJWQcdvOCsthmdaHfr3Gm2Kx4Ec=
go.uber.org/multierr v1.7.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak=
go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
go.uber.org/zap v1.17.0 h1:MTjgFu6ZLKvY6Pvaqk97GlxNBuMpV4Hy/3P6tRGlI2U=
go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo=
go4.org v0.0.0-20180809161055-417644f6feb5/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE=
golang.org/x/build v0.0.0-20190111050920-041ab4dc3f9d/go.mod h1:OWs+y06UdEOHN4y+MfF/py+xQ/tYqIWW03b70/CG9Rw=

View File

@ -10,8 +10,9 @@ import (
"github.com/google/uuid"
"github.com/mattermost/focalboard/server/server"
"github.com/mattermost/focalboard/server/services/config"
"github.com/mattermost/focalboard/server/services/mlog"
"github.com/webview/webview"
"github.com/mattermost/mattermost-server/v6/shared/mlog"
)
var sessionToken string = "su-" + uuid.New().String()
@ -31,7 +32,7 @@ func getFreePort() (int, error) {
}
func runServer(port int) (*server.Server, error) {
logger := mlog.NewLogger()
logger, _ := mlog.NewLogger()
config := &config.Configuration{
ServerRoot: fmt.Sprintf("http://localhost:%d", port),

View File

@ -7,7 +7,7 @@ replace github.com/mattermost/focalboard/server => ../server
require (
github.com/mattermost/focalboard/server v0.0.0-20210525112228-f43e4028dbdc
github.com/mattermost/mattermost-plugin-api v0.0.20
github.com/mattermost/mattermost-server/v6 v6.0.0-20210819192026-ab0e82d65692
github.com/mattermost/mattermost-server/v6 v6.0.0-20210824141503-6031b163d8e3
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.7.0
)

View File

@ -582,14 +582,14 @@ github.com/mattermost/ldap v0.0.0-20201202150706-ee0e6284187d h1:/RJ/UV7M5c7L2TQ
github.com/mattermost/ldap v0.0.0-20201202150706-ee0e6284187d/go.mod h1:HLbgMEI5K131jpxGazJ97AxfPDt31osq36YS1oxFQPQ=
github.com/mattermost/logr v1.0.13 h1:6F/fM3csvH6Oy5sUpJuW7YyZSzZZAhJm5VcgKMxA2P8=
github.com/mattermost/logr v1.0.13/go.mod h1:Mt4DPu1NXMe6JxPdwCC0XBoxXmN9eXOIRPoZarU2PXs=
github.com/mattermost/logr/v2 v2.0.4/go.mod h1:mpPp935r5dIkFDo2y9Q87cQWhFR/4xXpNh0k/y8Hmwg=
github.com/mattermost/logr/v2 v2.0.10 h1:i6rJbuX/EkBM9maM8M0eJ3rxB+fsBKNslPvzSlA2w/M=
github.com/mattermost/logr/v2 v2.0.10/go.mod h1:mpPp935r5dIkFDo2y9Q87cQWhFR/4xXpNh0k/y8Hmwg=
github.com/mattermost/logr/v2 v2.0.11 h1:eGg73t/HHkirGq34S+r6geGVuuVVrHDbW26QXCog6aw=
github.com/mattermost/logr/v2 v2.0.11/go.mod h1:mpPp935r5dIkFDo2y9Q87cQWhFR/4xXpNh0k/y8Hmwg=
github.com/mattermost/mattermost-plugin-api v0.0.20 h1:7qvZBb9JmYKAx6iSJXP/8Sd3dM4efMrZSITyC/bPA1o=
github.com/mattermost/mattermost-plugin-api v0.0.20/go.mod h1:473XiIxIyNqOsm5jmU3USkO+XWk7iLPVhLwKXR2cdkY=
github.com/mattermost/mattermost-server/v6 v6.0.0-20210817091833-04b27ce93c02/go.mod h1:lRyN5kvq4pllE0+9fGsxneaSRDszzaRISo6Z49YHg+M=
github.com/mattermost/mattermost-server/v6 v6.0.0-20210819192026-ab0e82d65692 h1:X0AvrYQsLFOaS02jNDJgnZmkESII27F4lOV+f7RCV5A=
github.com/mattermost/mattermost-server/v6 v6.0.0-20210819192026-ab0e82d65692/go.mod h1:+S8CsNEPv1FOl1usaPBQ6Gu9+Sm1Cc9YdU/Qh1YMGVI=
github.com/mattermost/mattermost-server/v6 v6.0.0-20210824141503-6031b163d8e3 h1:QTxrstPliume2trhYjv+Pl3xCkQZBPbgvrvk/F5Iscg=
github.com/mattermost/mattermost-server/v6 v6.0.0-20210824141503-6031b163d8e3/go.mod h1:+S8CsNEPv1FOl1usaPBQ6Gu9+Sm1Cc9YdU/Qh1YMGVI=
github.com/mattermost/rsc v0.0.0-20160330161541-bbaefb05eaa0/go.mod h1:nV5bfVpT//+B1RPD2JvRnxbkLmJEYXmRaaVl15fsXjs=
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ=

View File

@ -8,7 +8,6 @@ import (
"github.com/mattermost/focalboard/server/server"
"github.com/mattermost/focalboard/server/services/config"
"github.com/mattermost/focalboard/server/services/mlog"
"github.com/mattermost/focalboard/server/services/store"
"github.com/mattermost/focalboard/server/services/store/mattermostauthlayer"
"github.com/mattermost/focalboard/server/services/store/sqlstore"
@ -17,6 +16,7 @@ import (
"github.com/mattermost/mattermost-server/v6/model"
"github.com/mattermost/mattermost-server/v6/plugin"
"github.com/mattermost/mattermost-server/v6/shared/mlog"
)
// Plugin implements the interface expected by the Mattermost server to communicate between the server and plugin processes.
@ -90,7 +90,7 @@ func (p *Plugin) OnActivate() error {
filesS3Config.Trace = *mmconfig.FileSettings.AmazonS3Trace
}
logger := mlog.NewLogger()
logger, _ := mlog.NewLogger()
cfgJSON := defaultLoggingConfig()
err := logger.Configure("", cfgJSON)
if err != nil {

View File

@ -8,7 +8,8 @@ import (
"github.com/gorilla/mux"
"github.com/mattermost/focalboard/server/services/audit"
"github.com/mattermost/focalboard/server/services/mlog"
"github.com/mattermost/mattermost-server/v6/shared/mlog"
)
type AdminSetPasswordData struct {

View File

@ -15,9 +15,10 @@ import (
"github.com/mattermost/focalboard/server/app"
"github.com/mattermost/focalboard/server/model"
"github.com/mattermost/focalboard/server/services/audit"
"github.com/mattermost/focalboard/server/services/mlog"
"github.com/mattermost/focalboard/server/services/store"
"github.com/mattermost/focalboard/server/utils"
"github.com/mattermost/mattermost-server/v6/shared/mlog"
)
const (

View File

@ -15,7 +15,8 @@ import (
"github.com/mattermost/focalboard/server/model"
"github.com/mattermost/focalboard/server/services/audit"
"github.com/mattermost/focalboard/server/services/auth"
"github.com/mattermost/focalboard/server/services/mlog"
"github.com/mattermost/mattermost-server/v6/shared/mlog"
)
const (

View File

@ -5,10 +5,11 @@ import (
"github.com/mattermost/focalboard/server/model"
"github.com/mattermost/focalboard/server/services/config"
"github.com/mattermost/focalboard/server/services/metrics"
"github.com/mattermost/focalboard/server/services/mlog"
"github.com/mattermost/focalboard/server/services/store"
"github.com/mattermost/focalboard/server/services/webhook"
"github.com/mattermost/mattermost-server/v6/shared/mlog"
"github.com/mattermost/mattermost-server/v6/shared/filestore"
)

View File

@ -4,9 +4,10 @@ import (
"github.com/google/uuid"
"github.com/mattermost/focalboard/server/model"
"github.com/mattermost/focalboard/server/services/auth"
"github.com/mattermost/focalboard/server/services/mlog"
"github.com/mattermost/focalboard/server/services/store"
"github.com/mattermost/mattermost-server/v6/shared/mlog"
"github.com/pkg/errors"
)

View File

@ -20,7 +20,8 @@ var mockUser = &model.User{
}
func TestLogin(t *testing.T) {
th := SetupTestHelper(t)
th, tearDown := SetupTestHelper(t)
defer tearDown()
testcases := []struct {
title string
@ -58,7 +59,8 @@ func TestLogin(t *testing.T) {
}
func TestGetUser(t *testing.T) {
th := SetupTestHelper(t)
th, tearDown := SetupTestHelper(t)
defer tearDown()
testcases := []struct {
title string
@ -87,7 +89,8 @@ func TestGetUser(t *testing.T) {
}
func TestRegisterUser(t *testing.T) {
th := SetupTestHelper(t)
th, tearDown := SetupTestHelper(t)
defer tearDown()
testcases := []struct {
title string
@ -123,7 +126,8 @@ func TestRegisterUser(t *testing.T) {
}
func TestUpdateUserPassword(t *testing.T) {
th := SetupTestHelper(t)
th, tearDown := SetupTestHelper(t)
defer tearDown()
testcases := []struct {
title string
@ -153,7 +157,8 @@ func TestUpdateUserPassword(t *testing.T) {
}
func TestChangePassword(t *testing.T) {
th := SetupTestHelper(t)
th, tearDown := SetupTestHelper(t)
defer tearDown()
testcases := []struct {
title string

View File

@ -19,7 +19,8 @@ func (be blockError) Error() string {
}
func TestGetParentID(t *testing.T) {
th := SetupTestHelper(t)
th, tearDown := SetupTestHelper(t)
defer tearDown()
container := st.Container{
WorkspaceID: "0",
@ -40,7 +41,8 @@ func TestGetParentID(t *testing.T) {
}
func TestInsertBlock(t *testing.T) {
th := SetupTestHelper(t)
th, tearDown := SetupTestHelper(t)
defer tearDown()
container := st.Container{
WorkspaceID: "0",

View File

@ -6,9 +6,10 @@ import (
"path/filepath"
"strings"
"github.com/mattermost/focalboard/server/services/mlog"
"github.com/mattermost/focalboard/server/utils"
"github.com/mattermost/mattermost-server/v6/shared/mlog"
"github.com/mattermost/mattermost-server/v6/shared/filestore"
)

View File

@ -10,26 +10,27 @@ import (
"github.com/mattermost/focalboard/server/auth"
"github.com/mattermost/focalboard/server/services/config"
"github.com/mattermost/focalboard/server/services/metrics"
"github.com/mattermost/focalboard/server/services/mlog"
"github.com/mattermost/focalboard/server/services/store/mockstore"
"github.com/mattermost/focalboard/server/services/webhook"
"github.com/mattermost/focalboard/server/ws"
"github.com/mattermost/mattermost-server/v6/shared/filestore/mocks"
"github.com/mattermost/mattermost-server/v6/shared/mlog"
)
type TestHelper struct {
App *App
Store *mockstore.MockStore
App *App
Store *mockstore.MockStore
logger *mlog.Logger
}
func SetupTestHelper(t *testing.T) *TestHelper {
func SetupTestHelper(t *testing.T) (*TestHelper, func()) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
cfg := config.Configuration{}
store := mockstore.NewMockStore(ctrl)
auth := auth.New(&cfg, store)
logger := mlog.CreateTestLogger(t)
logger := mlog.CreateConsoleTestLogger(false, mlog.LvlDebug)
sessionToken := "TESTTOKEN"
wsserver := ws.NewServer(auth, sessionToken, false, logger)
webhook := webhook.NewClient(&cfg, logger)
@ -45,8 +46,15 @@ func SetupTestHelper(t *testing.T) *TestHelper {
}
app2 := New(&cfg, wsserver, appServices)
return &TestHelper{
App: app2,
Store: store,
tearDown := func() {
if logger != nil {
_ = logger.Shutdown()
}
}
return &TestHelper{
App: app2,
Store: store,
logger: logger,
}, tearDown
}

View File

@ -14,7 +14,9 @@ import (
)
func TestGetSharing(t *testing.T) {
th := SetupTestHelper(t)
th, tearDown := SetupTestHelper(t)
defer tearDown()
container := st.Container{
WorkspaceID: utils.CreateGUID(),
}
@ -61,7 +63,8 @@ func TestGetSharing(t *testing.T) {
}
func TestUpsertSharing(t *testing.T) {
th := SetupTestHelper(t)
th, tearDown := SetupTestHelper(t)
defer tearDown()
container := st.Container{
WorkspaceID: utils.CreateGUID(),

View File

@ -5,8 +5,9 @@ import (
"errors"
"github.com/mattermost/focalboard/server/model"
"github.com/mattermost/focalboard/server/services/mlog"
"github.com/mattermost/focalboard/server/utils"
"github.com/mattermost/mattermost-server/v6/shared/mlog"
)
func (a *App) GetRootWorkspace() (*model.Workspace, error) {

View File

@ -12,8 +12,8 @@ require (
github.com/gorilla/websocket v1.4.2
github.com/lib/pq v1.10.2
github.com/magiconair/properties v1.8.5 // indirect
github.com/mattermost/logr/v2 v2.0.4
github.com/mattermost/mattermost-server/v6 v6.0.0-20210817091833-04b27ce93c02
github.com/mattermost/logr/v2 v2.0.11 // indirect
github.com/mattermost/mattermost-server/v6 v6.0.0-20210824141503-6031b163d8e3
github.com/mattn/go-sqlite3 v2.0.3+incompatible
github.com/mitchellh/mapstructure v1.4.1 // indirect
github.com/oklog/run v1.1.0

View File

@ -579,10 +579,12 @@ github.com/mattermost/ldap v0.0.0-20201202150706-ee0e6284187d h1:/RJ/UV7M5c7L2TQ
github.com/mattermost/ldap v0.0.0-20201202150706-ee0e6284187d/go.mod h1:HLbgMEI5K131jpxGazJ97AxfPDt31osq36YS1oxFQPQ=
github.com/mattermost/logr v1.0.13 h1:6F/fM3csvH6Oy5sUpJuW7YyZSzZZAhJm5VcgKMxA2P8=
github.com/mattermost/logr v1.0.13/go.mod h1:Mt4DPu1NXMe6JxPdwCC0XBoxXmN9eXOIRPoZarU2PXs=
github.com/mattermost/logr/v2 v2.0.4 h1:LiqvzNNfia23hlu1zmmCDmjqmSfwWNsEtFlL4/7jf8o=
github.com/mattermost/logr/v2 v2.0.4/go.mod h1:mpPp935r5dIkFDo2y9Q87cQWhFR/4xXpNh0k/y8Hmwg=
github.com/mattermost/mattermost-server/v6 v6.0.0-20210817091833-04b27ce93c02 h1:v2SaNLiD02UAWJVwTvDBkFTqD2GwyPaRJ3vs7yDwcpE=
github.com/mattermost/mattermost-server/v6 v6.0.0-20210817091833-04b27ce93c02/go.mod h1:lRyN5kvq4pllE0+9fGsxneaSRDszzaRISo6Z49YHg+M=
github.com/mattermost/logr/v2 v2.0.10 h1:i6rJbuX/EkBM9maM8M0eJ3rxB+fsBKNslPvzSlA2w/M=
github.com/mattermost/logr/v2 v2.0.10/go.mod h1:mpPp935r5dIkFDo2y9Q87cQWhFR/4xXpNh0k/y8Hmwg=
github.com/mattermost/logr/v2 v2.0.11 h1:eGg73t/HHkirGq34S+r6geGVuuVVrHDbW26QXCog6aw=
github.com/mattermost/logr/v2 v2.0.11/go.mod h1:mpPp935r5dIkFDo2y9Q87cQWhFR/4xXpNh0k/y8Hmwg=
github.com/mattermost/mattermost-server/v6 v6.0.0-20210824141503-6031b163d8e3 h1:QTxrstPliume2trhYjv+Pl3xCkQZBPbgvrvk/F5Iscg=
github.com/mattermost/mattermost-server/v6 v6.0.0-20210824141503-6031b163d8e3/go.mod h1:+S8CsNEPv1FOl1usaPBQ6Gu9+Sm1Cc9YdU/Qh1YMGVI=
github.com/mattermost/rsc v0.0.0-20160330161541-bbaefb05eaa0/go.mod h1:nV5bfVpT//+B1RPD2JvRnxbkLmJEYXmRaaVl15fsXjs=
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ=
@ -923,7 +925,6 @@ github.com/viant/assertly v0.4.8/go.mod h1:aGifi++jvCrUaklKEKT0BU95igDNaqkvz+49u
github.com/viant/toolbox v0.24.0/go.mod h1:OxMCG57V0PXuIP2HNQrtJf2CjqdmbrOx5EkMILuUhzM=
github.com/vmihailenco/msgpack/v5 v5.3.4/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc=
github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds=
github.com/wiggin77/cfg v1.0.2 h1:NBUX+iJRr+RTncTqTNvajHwzduqbhCQjEqxLHr6Fk7A=
github.com/wiggin77/cfg v1.0.2/go.mod h1:b3gotba2e5bXTqTW48DwIFoLc+4lWKP7WPi/CdvZ4aE=
github.com/wiggin77/merror v1.0.2/go.mod h1:uQTcIU0Z6jRK4OwqganPYerzQxSFJ4GSHM3aurxxQpg=
github.com/wiggin77/merror v1.0.3 h1:8+ZHV+aSnJoYghE3EUThl15C6rvF2TYRSvOSBjdmNR8=
@ -982,15 +983,12 @@ go.opentelemetry.io/otel/trace v1.0.0-RC1/go.mod h1:86UHmyHWFEtWjfWPSbu0+d0Pf9Q6
go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/atomic v1.8.0 h1:CUhrE4N1rqSE6FM9ecihEjRkLQu8cDfgDyoOs83mEY4=
go.uber.org/atomic v1.8.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
go.uber.org/multierr v1.7.0 h1:zaiO/rmgFjbmCXdSYJWQcdvOCsthmdaHfr3Gm2Kx4Ec=
go.uber.org/multierr v1.7.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak=
go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
go.uber.org/zap v1.17.0 h1:MTjgFu6ZLKvY6Pvaqk97GlxNBuMpV4Hy/3P6tRGlI2U=
go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo=
go4.org v0.0.0-20180809161055-417644f6feb5/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE=
golang.org/x/build v0.0.0-20190111050920-041ab4dc3f9d/go.mod h1:OWs+y06UdEOHN4y+MfF/py+xQ/tYqIWW03b70/CG9Rw=

View File

@ -8,7 +8,8 @@ import (
"github.com/mattermost/focalboard/server/client"
"github.com/mattermost/focalboard/server/server"
"github.com/mattermost/focalboard/server/services/config"
"github.com/mattermost/focalboard/server/services/mlog"
"github.com/mattermost/mattermost-server/v6/shared/mlog"
)
type TestHelper struct {
@ -65,7 +66,7 @@ func getTestConfig() *config.Configuration {
}
func newTestServer(singleUserToken string) *server.Server {
logger := mlog.NewLogger()
logger, _ := mlog.NewLogger()
if err := logger.Configure("", getTestConfig().LoggingCfgJSON); err != nil {
panic(err)
}

View File

@ -39,7 +39,7 @@ import (
"github.com/mattermost/focalboard/server/services/config"
)
import (
"github.com/mattermost/focalboard/server/services/mlog"
"github.com/mattermost/mattermost-server/v6/shared/mlog"
)
// Active server used with shared code (dll)
@ -94,7 +94,7 @@ func main() {
return
}
logger := mlog.NewLogger()
logger, _ := mlog.NewLogger()
cfgJSON := config.LoggingCfgJSON
if config.LoggingCfgFile == "" && cfgJSON == "" {
// if no logging defined, use default config (console output)
@ -108,7 +108,7 @@ func main() {
defer func() { _ = logger.Shutdown() }()
if logger.HasTargets() {
restore := logger.RedirectStdLog(mlog.Info, mlog.String("src", "stdlog"))
restore := logger.RedirectStdLog(mlog.LvlInfo, mlog.String("src", "stdlog"))
defer restore()
}
@ -215,7 +215,7 @@ func startServer(webPath string, filesPath string, port int, singleUserToken, db
return
}
logger := mlog.NewLogger()
logger, _ := mlog.NewLogger()
err = logger.Configure(config.LoggingCfgFile, config.LoggingCfgJSON)
if err != nil {
log.Fatal("Error in config file for logger: ", err)

View File

@ -22,7 +22,6 @@ import (
"github.com/mattermost/focalboard/server/services/audit"
"github.com/mattermost/focalboard/server/services/config"
"github.com/mattermost/focalboard/server/services/metrics"
"github.com/mattermost/focalboard/server/services/mlog"
"github.com/mattermost/focalboard/server/services/scheduler"
"github.com/mattermost/focalboard/server/services/store"
"github.com/mattermost/focalboard/server/services/store/mattermostauthlayer"
@ -33,6 +32,8 @@ import (
"github.com/mattermost/focalboard/server/ws"
"github.com/oklog/run"
"github.com/mattermost/mattermost-server/v6/shared/mlog"
"github.com/mattermost/mattermost-server/v6/shared/filestore"
"github.com/mattermost/mattermost-server/v6/utils"
)
@ -104,9 +105,12 @@ func New(cfg *config.Configuration, singleUserToken string, db store.Store, logg
metricsService := metrics.NewMetrics(instanceInfo)
// Init audit
auditService := audit.NewAudit()
if err2 := auditService.Configure(cfg.AuditCfgFile, cfg.AuditCfgJSON); err2 != nil {
return nil, fmt.Errorf("unable to initialize the audit service: %w", err2)
auditService, errAudit := audit.NewAudit()
if errAudit != nil {
return nil, fmt.Errorf("unable to create the audit service: %w", errAudit)
}
if err := auditService.Configure(cfg.AuditCfgFile, cfg.AuditCfgJSON); err != nil {
return nil, fmt.Errorf("unable to initialize the audit service: %w", err)
}
appServices := app.Services{
@ -237,7 +241,7 @@ func (s *Server) Start() error {
s.logger.Error("Error updating metrics", mlog.String("group", "blocks"), mlog.Err(err))
return
}
s.logger.Log(mlog.Metrics, "Block metrics collected", mlog.Map("block_counts", blockCounts))
s.logger.Log(mlog.LvlFBMetrics, "Block metrics collected", mlog.Map("block_counts", blockCounts))
for blockType, count := range blockCounts {
s.metricsService.ObserveBlockCount(blockType, count)
}
@ -246,7 +250,7 @@ func (s *Server) Start() error {
s.logger.Error("Error updating metrics", mlog.String("group", "workspaces"), mlog.Err(err))
return
}
s.logger.Log(mlog.Metrics, "Workspace metrics collected", mlog.Int64("workspace_count", workspaceCount))
s.logger.Log(mlog.LvlFBMetrics, "Workspace metrics collected", mlog.Int64("workspace_count", workspaceCount))
s.metricsService.ObserveWorkspaceCount(workspaceCount)
}
// metricsUpdater() Calling this immediately causes integration unit tests to fail.

View File

@ -1,7 +1,7 @@
package audit
import (
"github.com/mattermost/focalboard/server/services/mlog"
"github.com/mattermost/mattermost-server/v6/shared/mlog"
)
const (
@ -34,12 +34,14 @@ type Audit struct {
}
// NewAudit creates a new Audit instance which can be configured via `(*Audit).Configure`.
func NewAudit(options ...mlog.Option) *Audit {
logger := mlog.NewLogger(options...)
func NewAudit(options ...mlog.Option) (*Audit, error) {
logger, err := mlog.NewLogger(options...)
if err != nil {
return nil, err
}
return &Audit{
auditLogger: logger,
}
}, nil
}
// Configure provides a new configuration for this audit service.

View File

@ -3,7 +3,7 @@
package audit
import "github.com/mattermost/focalboard/server/services/mlog"
import "github.com/mattermost/mattermost-server/v6/shared/mlog"
// Meta represents metadata that can be added to a audit record as name/value pairs.
type Meta struct {

View File

@ -3,9 +3,10 @@ package metrics
import (
"net/http"
"github.com/mattermost/focalboard/server/services/mlog"
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/mattermost/mattermost-server/v6/shared/mlog"
)
// Service prometheus to run the server.
@ -19,7 +20,7 @@ func NewMetricsServer(address string, metricsService *Metrics, logger *mlog.Logg
&http.Server{
Addr: address,
Handler: promhttp.HandlerFor(metricsService.registry, promhttp.HandlerOpts{
ErrorLog: logger.StdLogger(mlog.Error),
ErrorLog: logger.StdLogger(mlog.LvlError),
}),
},
}

View File

@ -1,42 +0,0 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
//nolint:gomnd
package mlog
import "github.com/mattermost/logr/v2"
// Standard levels.
var (
Panic = logr.Panic // ID = 0
Fatal = logr.Fatal // ID = 1
Error = logr.Error // ID = 2
Warn = logr.Warn // ID = 3
Info = logr.Info // ID = 4
Debug = logr.Debug // ID = 5
Trace = logr.Trace // ID = 6
StdAll = []Level{Panic, Fatal, Error, Warn, Info, Debug, Trace}
)
// Register custom (discrete) levels here.
// !!!!! Custom ID's must be between 20 and 32,768 !!!!!!
var (
/* Example
// used by the audit system
AuditAPI = Level{ID: 100, Name: "audit-api"}
AuditContent = Level{ID: 101, Name: "audit-content"}
AuditPerms = Level{ID: 102, Name: "audit-permissions"}
AuditCLI = Level{ID: 103, Name: "audit-cli"}
*/
// add more here ...
Telemetry = Level{ID: 500, Name: "telemetry"}
Metrics = Level{ID: 501, Name: "metrics"}
)
// Combinations for LogM (log multi).
var (
/* Example
MAuditAll = []Level{AuditAPI, AuditContent, AuditPerms, AuditCLI}
*/
)

View File

@ -1,281 +0,0 @@
// Package mlog provides a simple wrapper around Logr.
package mlog
import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"log"
"os"
"runtime"
"strings"
"time"
"github.com/mattermost/logr/v2"
logrcfg "github.com/mattermost/logr/v2/config"
)
const (
ShutdownTimeout = time.Second * 15
)
var (
mlogPkg string
)
func init() {
// Calc current package name
pcs := make([]uintptr, 2)
_ = runtime.Callers(0, pcs)
tmp := runtime.FuncForPC(pcs[1]).Name()
mlogPkg = GetPackageName(tmp)
}
// Type and function aliases from Logr to limit the spread of dependencies throughout Focalboard.
type Field = logr.Field
type Level = logr.Level
type Option = logr.Option
type Target = logr.Target
type LogRec = logr.LogRec
type LogCloner = logr.LogCloner
type MetricsCollector = logr.MetricsCollector
// Any picks the best supported field type based on type of val.
// For best performance when passing a struct (or struct pointer),
// implement `logr.LogWriter` on the struct, otherwise reflection
// will be used to generate a string representation.
var Any = logr.Any
// Int64 constructs a field containing a key and Int64 value.
var Int64 = logr.Int64
// Int32 constructs a field containing a key and Int32 value.
var Int32 = logr.Int32
// Int constructs a field containing a key and Int value.
var Int = logr.Int
// Uint64 constructs a field containing a key and Uint64 value.
var Uint64 = logr.Uint64
// Uint32 constructs a field containing a key and Uint32 value.
var Uint32 = logr.Uint32
// Uint constructs a field containing a key and Uint value.
var Uint = logr.Uint
// Float64 constructs a field containing a key and Float64 value.
var Float64 = logr.Float64
// Float32 constructs a field containing a key and Float32 value.
var Float32 = logr.Float32
// String constructs a field containing a key and String value.
var String = logr.String
// Stringer constructs a field containing a key and a fmt.Stringer value.
// The fmt.Stringer's `String` method is called lazily.
var Stringer = logr.Stringer
// Err constructs a field containing a default key ("error") and error value.
var Err = logr.Err
// NamedErr constructs a field containing a key and error value.
var NamedErr = logr.NamedErr
// Bool constructs a field containing a key and bool value.
var Bool = logr.Bool
// Time constructs a field containing a key and time.Time value.
var Time = logr.Time
// Duration constructs a field containing a key and time.Duration value.
var Duration = logr.Duration
// Millis constructs a field containing a key and timestamp value.
// The timestamp is expected to be milliseconds since Jan 1, 1970 UTC.
var Millis = logr.Millis
// Array constructs a field containing a key and array value.
var Array = logr.Array
// Map constructs a field containing a key and map value.
var Map = logr.Map
// LoggerConfig is a map of LogTarget configurations.
type LoggerConfig map[string]logrcfg.TargetCfg
func (lc LoggerConfig) append(cfg LoggerConfig) {
for k, v := range cfg {
lc[k] = v
}
}
// Logger provides a thin wrapper around a Logr instance. This is a struct instead of an interface
// so that there are no allocations on the heap each interface method invocation. Normally not
// something to be concerned about, but logging calls for disabled levels should have as little CPU
// and memory impact as possible. Most of these wrapper calls will be inlined as well.
type Logger struct {
log *logr.Logger
}
// NewLogger creates a new Logger instance which can be configured via `(*Logger).Configure`.
func NewLogger(options ...Option) *Logger {
options = append(options, logr.StackFilter(GetPackageName(mlogPkg)))
lgr, _ := logr.New(options...)
log := lgr.NewLogger()
return &Logger{
log: &log,
}
}
// Configure provides a new configuration for this logger.
// Zero or more sources of config can be provided:
// cfgFile - path to file containing JSON
// cfgEscaped - JSON string probably from ENV var
//
// For each case JSON containing log targets is provided. Target name collisions are resolved
// using the following precedence:
// cfgFile > cfgEscaped
func (l *Logger) Configure(cfgFile string, cfgEscaped string) error {
cfgMap := make(LoggerConfig)
// Add config from file
if cfgFile != "" {
b, err := ioutil.ReadFile(cfgFile)
if err != nil {
return fmt.Errorf("error reading logger config file %s: %w", cfgFile, err)
}
var mapCfgFile LoggerConfig
if err := json.Unmarshal(b, &mapCfgFile); err != nil {
return fmt.Errorf("error decoding logger config file %s: %w", cfgFile, err)
}
cfgMap.append(mapCfgFile)
}
// Add config from escaped json string
if cfgEscaped != "" {
var mapCfgEscaped LoggerConfig
if err := json.Unmarshal([]byte(cfgEscaped), &mapCfgEscaped); err != nil {
return fmt.Errorf("error decoding logger config as escaped json: %w", err)
}
cfgMap.append(mapCfgEscaped)
}
if len(cfgMap) == 0 {
return nil
}
return logrcfg.ConfigureTargets(l.log.Logr(), cfgMap, nil)
}
// With creates a new Logger with the specified fields. This is a light-weight
// operation and can be called on demand.
func (l *Logger) With(fields ...Field) *Logger {
logWith := l.log.With(fields...)
return &Logger{
log: &logWith,
}
}
// IsLevelEnabled returns true only if at least one log target is
// configured to emit the specified log level. Use this check when
// gathering the log info may be expensive.
//
// Note, transformations and serializations done via fields are already
// lazily evaluated and don't require this check beforehand.
func (l *Logger) IsLevelEnabled(level Level) bool {
return l.log.IsLevelEnabled(level)
}
// Log emits the log record for any targets configured for the specified level.
func (l *Logger) Log(level Level, msg string, fields ...Field) {
l.log.Log(level, msg, fields...)
}
// LogM emits the log record for any targets configured for the specified levels.
// Equivalent to calling `Log` once for each level.
func (l *Logger) LogM(levels []Level, msg string, fields ...Field) {
l.log.LogM(levels, msg, fields...)
}
// Convenience method equivalent to calling `Log` with the `Trace` level.
func (l *Logger) Trace(msg string, fields ...Field) {
l.log.Trace(msg, fields...)
}
// Convenience method equivalent to calling `Log` with the `Debug` level.
func (l *Logger) Debug(msg string, fields ...Field) {
l.log.Debug(msg, fields...)
}
// Convenience method equivalent to calling `Log` with the `Info` level.
func (l *Logger) Info(msg string, fields ...Field) {
l.log.Info(msg, fields...)
}
// Convenience method equivalent to calling `Log` with the `Warn` level.
func (l *Logger) Warn(msg string, fields ...Field) {
l.log.Warn(msg, fields...)
}
// Convenience method equivalent to calling `Log` with the `Error` level.
func (l *Logger) Error(msg string, fields ...Field) {
l.log.Error(msg, fields...)
}
// Convenience method equivalent to calling `Log` with the `Fatal` level,
// followed by `os.Exit(1)`.
func (l *Logger) Fatal(msg string, fields ...Field) {
l.log.Log(logr.Fatal, msg, fields...)
_ = l.Shutdown()
os.Exit(1)
}
// HasTargets returns true if at least one log target has been added.
func (l *Logger) HasTargets() bool {
return l.log.Logr().HasTargets()
}
// StdLogger creates a standard logger backed by this logger.
// All log records are output with the specified level.
func (l *Logger) StdLogger(level Level) *log.Logger {
return l.log.StdLogger(level)
}
// RedirectStdLog redirects output from the standard library's package-global logger
// to this logger at the specified level and with zero or more Field's. Since this logger already
// handles caller annotations, timestamps, etc., it automatically disables the standard
// library's annotations and prefixing.
// A function is returned that restores the original prefix and flags and resets the standard
// library's output to os.Stdout.
func (l *Logger) RedirectStdLog(level Level, fields ...Field) func() {
return l.log.Logr().RedirectStdLog(level, fields...)
}
// Shutdown shuts down the logger after making best efforts to flush any
// remaining records.
func (l *Logger) Shutdown() error {
ctx, cancel := context.WithTimeout(context.Background(), ShutdownTimeout)
defer cancel()
return l.log.Logr().ShutdownWithTimeout(ctx)
}
// GetPackageName reduces a fully qualified function name to the package name
// By sirupsen: https://github.com/sirupsen/logrus/blob/master/entry.go
func GetPackageName(f string) string {
for {
lastPeriod := strings.LastIndex(f, ".")
lastSlash := strings.LastIndex(f, "/")
if lastPeriod > lastSlash {
f = f[:lastPeriod]
} else {
break
}
}
return f
}

View File

@ -1,52 +0,0 @@
package mlog
import "github.com/mattermost/logr/v2"
// MaxQueueSize is the maximum number of log records that can be queued.
// If exceeded, `OnQueueFull` is called which determines if the log
// record will be dropped or block until add is successful.
// Defaults to DefaultMaxQueueSize.
func MaxQueueSize(size int) Option {
return logr.MaxQueueSize(size)
}
// OnLoggerError, when not nil, is called any time an internal
// logging error occurs. For example, this can happen when a
// target cannot connect to its data sink.
func OnLoggerError(f func(error)) Option {
return logr.OnLoggerError(f)
}
// OnQueueFull, when not nil, is called on an attempt to add
// a log record to a full Logr queue.
// `MaxQueueSize` can be used to modify the maximum queue size.
// This function should return quickly, with a bool indicating whether
// the log record should be dropped (true) or block until the log record
// is successfully added (false). If nil then blocking (false) is assumed.
func OnQueueFull(f func(rec *LogRec, maxQueueSize int) bool) Option {
return logr.OnQueueFull(f)
}
// OnTargetQueueFull, when not nil, is called on an attempt to add
// a log record to a full target queue provided the target supports reporting
// this condition.
// This function should return quickly, with a bool indicating whether
// the log record should be dropped (true) or block until the log record
// is successfully added (false). If nil then blocking (false) is assumed.
func OnTargetQueueFull(f func(target Target, rec *LogRec, maxQueueSize int) bool) Option {
return logr.OnTargetQueueFull(f)
}
// SetMetricsCollector enables metrics collection by supplying a MetricsCollector.
// The MetricsCollector provides counters and gauges that are updated by log targets.
// `updateFreqMillis` determines how often polled metrics are updated. Defaults to 15000 (15 seconds)
// and must be at least 250 so we don't peg the CPU.
func SetMetricsCollector(collector MetricsCollector, updateFreqMillis int64) Option {
return logr.SetMetricsCollector(collector, updateFreqMillis)
}
// StackFilter provides a list of package names to exclude from the top of
// stack traces. The Logr packages are automatically filtered.
func StackFilter(pkg ...string) Option {
return logr.StackFilter(pkg...)
}

View File

@ -1,62 +0,0 @@
package mlog
import (
"sync"
"testing"
"github.com/mattermost/logr/v2"
"github.com/mattermost/logr/v2/formatters"
)
// CreateTestLogger creates a logger for unit tests. Log records are output to `(*testing.T)Log`.
func CreateTestLogger(t *testing.T, levels ...Field) (logger *Logger) {
logger = NewLogger()
filter := logr.NewCustomFilter(StdAll...)
formatter := &formatters.Plain{}
target := newTestingTarget(t)
if err := logger.log.Logr().AddTarget(target, "test", filter, formatter, 1000); err != nil {
t.Fail()
return nil
}
return logger
}
// testingTarget is a simple log target that writes to the testing log.
type testingTarget struct {
mux sync.Mutex
t *testing.T
}
func newTestingTarget(t *testing.T) *testingTarget {
return &testingTarget{
t: t,
}
}
// Init is called once to initialize the target.
func (tt *testingTarget) Init() error {
return nil
}
// Write outputs bytes to this file target.
func (tt *testingTarget) Write(p []byte, rec *logr.LogRec) (int, error) {
tt.mux.Lock()
defer tt.mux.Unlock()
if tt.t != nil {
tt.t.Log(string(p))
}
return len(p), nil
}
// Shutdown is called once to free/close any resources.
// Target queue is already drained when this is called.
func (tt *testingTarget) Shutdown() error {
tt.mux.Lock()
defer tt.mux.Unlock()
tt.t = nil
return nil
}

View File

@ -9,8 +9,9 @@ import (
sq "github.com/Masterminds/squirrel"
"github.com/mattermost/focalboard/server/model"
"github.com/mattermost/focalboard/server/services/mlog"
"github.com/mattermost/focalboard/server/services/store"
"github.com/mattermost/mattermost-server/v6/shared/mlog"
)
const (

View File

@ -12,9 +12,10 @@ import (
sq "github.com/Masterminds/squirrel"
_ "github.com/lib/pq" // postgres driver
"github.com/mattermost/focalboard/server/model"
"github.com/mattermost/focalboard/server/services/mlog"
"github.com/mattermost/focalboard/server/services/store"
_ "github.com/mattn/go-sqlite3" // sqlite driver
"github.com/mattermost/mattermost-server/v6/shared/mlog"
)
type RootIDNilError struct{}

View File

@ -5,9 +5,10 @@ import (
sq "github.com/Masterminds/squirrel"
"github.com/mattermost/focalboard/server/model"
"github.com/mattermost/focalboard/server/services/mlog"
"github.com/mattermost/focalboard/server/services/store"
"github.com/mattermost/focalboard/server/services/store/sqlstore/initializations"
"github.com/mattermost/mattermost-server/v6/shared/mlog"
)
// InitializeTemplates imports default templates if the blocks table is empty.

View File

@ -4,7 +4,8 @@ import (
"database/sql"
sq "github.com/Masterminds/squirrel"
"github.com/mattermost/focalboard/server/services/mlog"
"github.com/mattermost/mattermost-server/v6/shared/mlog"
)
const (

View File

@ -5,10 +5,11 @@ import (
"os"
"testing"
"github.com/mattermost/focalboard/server/services/mlog"
"github.com/mattermost/focalboard/server/services/store"
"github.com/mattermost/focalboard/server/services/store/storetests"
"github.com/stretchr/testify/require"
"github.com/mattermost/mattermost-server/v6/shared/mlog"
)
func SetupTests(t *testing.T) (store.Store, func()) {
@ -22,7 +23,7 @@ func SetupTests(t *testing.T) (store.Store, func()) {
connectionString = ":memory:"
}
logger := mlog.CreateTestLogger(t)
logger := mlog.CreateConsoleTestLogger(false, mlog.LvlDebug)
sqlDB, err := sql.Open(dbType, connectionString)
require.NoError(t, err)

View File

@ -3,7 +3,7 @@ package sqlstore
import (
"database/sql"
"github.com/mattermost/focalboard/server/services/mlog"
"github.com/mattermost/mattermost-server/v6/shared/mlog"
)
func (s *SQLStore) CloseRows(rows *sql.Rows) {

View File

@ -5,9 +5,10 @@ import (
"time"
"github.com/mattermost/focalboard/server/model"
"github.com/mattermost/focalboard/server/services/mlog"
"github.com/mattermost/focalboard/server/utils"
"github.com/mattermost/mattermost-server/v6/shared/mlog"
sq "github.com/Masterminds/squirrel"
)

View File

@ -8,9 +8,10 @@ import (
"strings"
"time"
"github.com/mattermost/focalboard/server/services/mlog"
"github.com/mattermost/focalboard/server/services/scheduler"
rudder "github.com/rudderlabs/analytics-go"
"github.com/mattermost/mattermost-server/v6/shared/mlog"
)
const (
@ -91,7 +92,7 @@ func (ts *Service) sendTelemetry(event string, properties map[string]interface{}
func (ts *Service) initRudder(endpoint, rudderKey string) {
if ts.rudderClient == nil {
config := rudder.Config{}
config.Logger = rudder.StdLogger(ts.logger.StdLogger(mlog.Telemetry))
config.Logger = rudder.StdLogger(ts.logger.StdLogger(mlog.LvlFBTelemetry))
config.Endpoint = endpoint
// For testing
if endpoint != rudderDataplaneURL {

View File

@ -8,7 +8,8 @@ import (
"github.com/mattermost/focalboard/server/model"
"github.com/mattermost/focalboard/server/services/config"
"github.com/mattermost/focalboard/server/services/mlog"
"github.com/mattermost/mattermost-server/v6/shared/mlog"
)
// NotifyUpdate calls webhooks.

View File

@ -7,7 +7,9 @@ import (
"github.com/mattermost/focalboard/server/model"
"github.com/mattermost/focalboard/server/services/config"
"github.com/mattermost/focalboard/server/services/mlog"
"github.com/stretchr/testify/assert"
"github.com/mattermost/mattermost-server/v6/shared/mlog"
)
func TestClientUpdateNotify(t *testing.T) {
@ -21,7 +23,13 @@ func TestClientUpdateNotify(t *testing.T) {
WebhookUpdate: []string{ts.URL},
}
client := NewClient(cfg, mlog.CreateTestLogger(t))
logger := mlog.CreateConsoleTestLogger(false, mlog.LvlDebug)
defer func() {
err := logger.Shutdown()
assert.NoError(t, err)
}()
client := NewClient(cfg, logger)
client.NotifyUpdate(model.Block{})

View File

@ -11,7 +11,8 @@ import (
"text/template"
"github.com/gorilla/mux"
"github.com/mattermost/focalboard/server/services/mlog"
"github.com/mattermost/mattermost-server/v6/shared/mlog"
)
// RoutedService defines the interface that is needed for any service to

View File

@ -11,8 +11,9 @@ import (
"github.com/gorilla/websocket"
"github.com/mattermost/focalboard/server/auth"
"github.com/mattermost/focalboard/server/model"
"github.com/mattermost/focalboard/server/services/mlog"
"github.com/mattermost/focalboard/server/services/store"
"github.com/mattermost/mattermost-server/v6/shared/mlog"
)
const (

View File

@ -5,7 +5,8 @@ import (
"testing"
"github.com/mattermost/focalboard/server/auth"
"github.com/mattermost/focalboard/server/services/mlog"
"github.com/mattermost/mattermost-server/v6/shared/mlog"
"github.com/gorilla/websocket"
"github.com/stretchr/testify/require"