diff --git a/services/postprocessing/pkg/command/server.go b/services/postprocessing/pkg/command/server.go index 575bc40cf..c80e00f9f 100644 --- a/services/postprocessing/pkg/command/server.go +++ b/services/postprocessing/pkg/command/server.go @@ -6,11 +6,11 @@ import ( "os" "os/signal" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/pkg/runner" "github.com/opencloud-eu/opencloud/pkg/tracing" "github.com/opencloud-eu/opencloud/services/postprocessing/pkg/config" "github.com/opencloud-eu/opencloud/services/postprocessing/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/postprocessing/pkg/logging" "github.com/opencloud-eu/opencloud/services/postprocessing/pkg/server/debug" "github.com/opencloud-eu/opencloud/services/postprocessing/pkg/service" "github.com/opencloud-eu/reva/v2/pkg/store" @@ -33,7 +33,7 @@ func Server(cfg *config.Config) *cobra.Command { return err }, RunE: func(cmd *cobra.Command, args []string) error { - logger := logging.Configure(cfg.Service.Name, cfg.Log) + logger := log.Configure(cfg.Service.Name, cfg.Commons, cfg.LogLevel) var cancel context.CancelFunc if cfg.Context == nil { diff --git a/services/postprocessing/pkg/config/config.go b/services/postprocessing/pkg/config/config.go index d651d602a..858f6e514 100644 --- a/services/postprocessing/pkg/config/config.go +++ b/services/postprocessing/pkg/config/config.go @@ -13,8 +13,8 @@ type Config struct { Service Service `yaml:"-"` - Log *Log `yaml:"log"` - Debug Debug `yaml:"debug"` + LogLevel string `yaml:"loglevel" env:"OC_LOG_LEVEL;POSTPROCESSING_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + Debug Debug `yaml:"debug"` Store Store `yaml:"store"` Postprocessing Postprocessing `yaml:"postprocessing"` diff --git a/services/postprocessing/pkg/config/defaults/defaultconfig.go b/services/postprocessing/pkg/config/defaults/defaultconfig.go index 09305ba7c..39186aaa1 100644 --- a/services/postprocessing/pkg/config/defaults/defaultconfig.go +++ b/services/postprocessing/pkg/config/defaults/defaultconfig.go @@ -48,18 +48,9 @@ func DefaultConfig() *config.Config { // EnsureDefaults ensures defaults on a config func EnsureDefaults(cfg *config.Config) { - // provide with defaults for shared logging, since we need a valid destination address for BindEnv. - if cfg.Log == nil && cfg.Commons != nil && cfg.Commons.Log != nil { - cfg.Log = &config.Log{ - Level: cfg.Commons.Log.Level, - Pretty: cfg.Commons.Log.Pretty, - Color: cfg.Commons.Log.Color, - File: cfg.Commons.Log.File, - } - } else if cfg.Log == nil { - cfg.Log = &config.Log{} + if cfg.LogLevel == "" { + cfg.LogLevel = "error" } - } // Sanitize does nothing atm diff --git a/services/postprocessing/pkg/config/log.go b/services/postprocessing/pkg/config/log.go deleted file mode 100644 index 1066e805f..000000000 --- a/services/postprocessing/pkg/config/log.go +++ /dev/null @@ -1,9 +0,0 @@ -package config - -// Log defines the available log configuration. -type Log struct { - Level string `mapstructure:"level" env:"OC_LOG_LEVEL;POSTPROCESSING_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` - Pretty bool `mapstructure:"pretty" env:"OC_LOG_PRETTY;POSTPROCESSING_LOG_PRETTY" desc:"Activates pretty log output." introductionVersion:"1.0.0"` - Color bool `mapstructure:"color" env:"OC_LOG_COLOR;POSTPROCESSING_LOG_COLOR" desc:"Activates colorized log output." introductionVersion:"1.0.0"` - File string `mapstructure:"file" env:"OC_LOG_FILE;POSTPROCESSING_LOG_FILE" desc:"The path to the log file. Activates logging to this file if set." introductionVersion:"1.0.0"` -} diff --git a/services/postprocessing/pkg/logging/logging.go b/services/postprocessing/pkg/logging/logging.go deleted file mode 100644 index 98468ab7e..000000000 --- a/services/postprocessing/pkg/logging/logging.go +++ /dev/null @@ -1,17 +0,0 @@ -package logging - -import ( - "github.com/opencloud-eu/opencloud/pkg/log" - "github.com/opencloud-eu/opencloud/services/postprocessing/pkg/config" -) - -// Configure initializes a service-specific logger instance. -func Configure(name string, cfg *config.Log) log.Logger { - return log.NewLogger( - log.Name(name), - log.Level(cfg.Level), - log.Pretty(cfg.Pretty), - log.Color(cfg.Color), - log.File(cfg.File), - ) -}