mirror of
https://github.com/mattermost/focalboard.git
synced 2024-12-24 13:43:12 +02:00
4b0fb92fba
- provides support for compiling Boards directly into the Mattermost suite server - a ServicesAPI interface replaces the PluginAPI to allow for implementations coming from pluginAPI and suite server. - a new product package provides a place to register Boards as a suite product and handles life-cycle events - a new boards package replaces much of the mattermost-plugin logic, allowing this to be shared between plugin and product - Boards now uses module workspaces; run make setup-go-work
60 lines
1.1 KiB
Go
60 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
|
|
}
|