1
0
mirror of https://github.com/mattermost/focalboard.git synced 2025-03-20 20:45:00 +02:00

Print log server information on plugin run (#3711)

* Print log server information on plugin run

* Add LogServerInfo to product mode

* Fix log location
This commit is contained in:
Miguel de la Cruz 2022-08-19 19:16:18 +02:00 committed by GitHub
parent feb49eaf19
commit 831dff6192
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 12 deletions

View File

@ -8,6 +8,7 @@ import (
"fmt"
"github.com/mattermost/focalboard/mattermost-plugin/server/boards"
"github.com/mattermost/focalboard/server/model"
"github.com/mattermost/mattermost-server/v6/app"
mm_model "github.com/mattermost/mattermost-server/v6/model"
@ -197,6 +198,8 @@ func (bp *boardsProduct) Start() error {
return fmt.Errorf("failed to create Boards service: %w", err)
}
model.LogServerInfo(bp.logger)
bp.boardsApp = boardsApp
if err := bp.boardsApp.Start(); err != nil {
return fmt.Errorf("failed to start Boards service: %w", err)

View File

@ -9,6 +9,7 @@ import (
"net/http"
"github.com/mattermost/focalboard/mattermost-plugin/server/boards"
"github.com/mattermost/focalboard/server/model"
pluginapi "github.com/mattermost/mattermost-plugin-api"
@ -52,6 +53,8 @@ func (p *Plugin) OnActivate() error {
return fmt.Errorf("cannot activate plugin: %w", err)
}
model.LogServerInfo(logger)
p.boardsApp = boardsApp
return p.boardsApp.Start()
}

View File

@ -53,16 +53,6 @@ func monitorPid(pid int, logger *mlog.Logger) {
}()
}
func logInfo(logger *mlog.Logger) {
logger.Info("FocalBoard Server",
mlog.String("version", model.CurrentVersion),
mlog.String("edition", model.Edition),
mlog.String("build_number", model.BuildNumber),
mlog.String("build_date", model.BuildDate),
mlog.String("build_hash", model.BuildHash),
)
}
func main() {
// Command line args
pMonitorPid := flag.Int("monitorpid", -1, "a process ID")
@ -101,7 +91,7 @@ func main() {
defer restore()
}
logInfo(logger)
model.LogServerInfo(logger)
singleUser := false
if pSingleUser != nil {
@ -214,7 +204,7 @@ func startServer(webPath string, filesPath string, port int, singleUserToken, db
return
}
logInfo(logger)
model.LogServerInfo(logger)
if len(filesPath) > 0 {
config.FilesPath = filesPath

View File

@ -1,5 +1,9 @@
package model
import (
"github.com/mattermost/mattermost-server/v6/shared/mlog"
)
// This is a list of all the current versions including any patches.
// It should be maintained in chronological order with most current
// release at the front of the list.
@ -41,3 +45,14 @@ var (
BuildHash string
Edition string
)
// LogServerInfo logs information about the server instance.
func LogServerInfo(logger mlog.LoggerIFace) {
logger.Info("FocalBoard Server",
mlog.String("version", CurrentVersion),
mlog.String("edition", Edition),
mlog.String("build_number", BuildNumber),
mlog.String("build_date", BuildDate),
mlog.String("build_hash", BuildHash),
)
}