605c0079eb
* skeleton lifecycle * bare minimum to satisfy mm-server import * added boards_imports.go * move boards_imports.go to correct package * bump mmserver version; remove replace in go.mod; use module workspaces; remove logger service * rename product.go --> boards.go * add FileInfoStore and Cloud services for product; create minimal pluginAPI interfaces for all packages * rename Boards -> BoardsProduct * compile success * remove hooks service; guard for nil BoardsApp * update to latest mmserver ver * upgrade mmserver to master tip * upgrade mmserver to master tip * bump plugin-api to master tip * fix users service * fix OnActivate crash; normalize AppError returns * fileBackend interface for server/app * feature flag * bump mmserver version * fix linter errors * make go.work when linting * fix go.work creation for CI * add execute flag for script * fix more linter errors * always create a go.work * fix ci go.work * OS agnostic go.work generator * fix path * fix path again * partially disable cypress test * fix case Id --> ID * bump mmserver version * include in go.work for dev * addressed review comments. Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
59 lines
1.1 KiB
Go
59 lines
1.1 KiB
Go
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
package notifylogger
|
|
|
|
import (
|
|
"github.com/mattermost/focalboard/server/services/notify"
|
|
|
|
"github.com/mattermost/mattermost-server/v6/shared/mlog"
|
|
)
|
|
|
|
const (
|
|
backendName = "notifyLogger"
|
|
)
|
|
|
|
type Backend struct {
|
|
logger mlog.LoggerIFace
|
|
level mlog.Level
|
|
}
|
|
|
|
func New(logger mlog.LoggerIFace, level mlog.Level) *Backend {
|
|
return &Backend{
|
|
logger: logger,
|
|
level: level,
|
|
}
|
|
}
|
|
|
|
func (b *Backend) Start() error {
|
|
return nil
|
|
}
|
|
|
|
func (b *Backend) ShutDown() error {
|
|
_ = b.logger.Flush()
|
|
return nil
|
|
}
|
|
|
|
func (b *Backend) BlockChanged(evt notify.BlockChangeEvent) error {
|
|
var board string
|
|
var card string
|
|
|
|
if evt.Board != nil {
|
|
board = evt.Board.Title
|
|
}
|
|
if evt.Card != nil {
|
|
card = evt.Card.Title
|
|
}
|
|
|
|
b.logger.Log(b.level, "Block change event",
|
|
mlog.String("action", string(evt.Action)),
|
|
mlog.String("board", board),
|
|
mlog.String("card", card),
|
|
mlog.String("block_id", evt.BlockChanged.ID),
|
|
)
|
|
return nil
|
|
}
|
|
|
|
func (b *Backend) Name() string {
|
|
return backendName
|
|
}
|