mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-07-18 19:44:24 -04:00
inherit logging config from ocis.yaml, let extensions overwrite their logging. Considering using a package level global logging...
This commit is contained in:
@@ -111,6 +111,7 @@ type SutureService struct {
|
||||
|
||||
// NewSutureService creates a new web.SutureService
|
||||
func NewSutureService(cfg *ociscfg.Config) suture.Service {
|
||||
inheritLogging(cfg)
|
||||
if cfg.Mode == 0 {
|
||||
cfg.Web.Supervised = true
|
||||
}
|
||||
@@ -128,3 +129,13 @@ func (s SutureService) Serve(ctx context.Context) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// inheritLogging is a poor man's global logging state tip-toeing around circular dependencies. It sets the logging
|
||||
// of the service to whatever is in the higher config (in this case coming from ocis.yaml) and sets them as defaults,
|
||||
// being overwritten when the extension parses its config file / env variables.
|
||||
func inheritLogging(cfg *ociscfg.Config) {
|
||||
cfg.Web.Log.File = cfg.Log.File
|
||||
cfg.Web.Log.Color = cfg.Log.Color
|
||||
cfg.Web.Log.Pretty = cfg.Log.Pretty
|
||||
cfg.Web.Log.Level = cfg.Log.Level
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ func Server(cfg *config.Config) *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "server",
|
||||
Usage: "Start integrated server",
|
||||
Flags: append(flagset.ServerWithConfig(cfg), flagset.RootWithConfig(cfg)...),
|
||||
Flags: flagset.ServerWithConfig(cfg),
|
||||
Before: func(ctx *cli.Context) error {
|
||||
logger := NewLogger(cfg)
|
||||
if cfg.HTTP.Root != "/" {
|
||||
|
||||
Reference in New Issue
Block a user