From efd6331a6156a24131a4ab67de31f96a4d51f61d Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Wed, 7 Jan 2026 16:54:47 +0100 Subject: [PATCH 01/45] consolidate log config in activitylog Signed-off-by: Christian Richter --- pkg/shared/logging.go | 14 ++++++++++++++ services/activitylog/pkg/command/server.go | 4 ++-- services/activitylog/pkg/config/config.go | 3 ++- .../pkg/config/defaults/defaultconfig.go | 13 ++----------- services/activitylog/pkg/config/log.go | 9 --------- services/activitylog/pkg/logging/logging.go | 17 ----------------- 6 files changed, 20 insertions(+), 40 deletions(-) create mode 100644 pkg/shared/logging.go delete mode 100644 services/activitylog/pkg/config/log.go delete mode 100644 services/activitylog/pkg/logging/logging.go diff --git a/pkg/shared/logging.go b/pkg/shared/logging.go new file mode 100644 index 000000000..b774b1884 --- /dev/null +++ b/pkg/shared/logging.go @@ -0,0 +1,14 @@ +package shared + +import "github.com/opencloud-eu/opencloud/pkg/log" + +// Configure initializes a service-specific logger instance. +func Configure(name string, commons *Commons, localServiceLogLevel string) log.Logger { + return log.NewLogger( + log.Name(name), + log.Level(localServiceLogLevel), + log.Pretty(commons.Log.Pretty), + log.Color(commons.Log.Color), + log.File(commons.Log.File), + ) +} diff --git a/services/activitylog/pkg/command/server.go b/services/activitylog/pkg/command/server.go index ec86ee9b4..c7aed3e9b 100644 --- a/services/activitylog/pkg/command/server.go +++ b/services/activitylog/pkg/command/server.go @@ -5,6 +5,7 @@ import ( "fmt" "github.com/oklog/run" + "github.com/opencloud-eu/opencloud/pkg/shared" "github.com/opencloud-eu/reva/v2/pkg/events" "github.com/opencloud-eu/reva/v2/pkg/events/stream" "github.com/opencloud-eu/reva/v2/pkg/rgrpc/todo/pool" @@ -22,7 +23,6 @@ import ( settingssvc "github.com/opencloud-eu/opencloud/protogen/gen/opencloud/services/settings/v0" "github.com/opencloud-eu/opencloud/services/activitylog/pkg/config" "github.com/opencloud-eu/opencloud/services/activitylog/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/activitylog/pkg/logging" "github.com/opencloud-eu/opencloud/services/activitylog/pkg/metrics" "github.com/opencloud-eu/opencloud/services/activitylog/pkg/server/debug" "github.com/opencloud-eu/opencloud/services/activitylog/pkg/server/http" @@ -55,7 +55,7 @@ func Server(cfg *config.Config) *cobra.Command { return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, RunE: func(cmd *cobra.Command, args []string) error { - logger := logging.Configure(cfg.Service.Name, cfg.Log) + logger := shared.Configure(cfg.Service.Name, cfg.Commons, cfg.LogLevel) tracerProvider, err := tracing.GetTraceProvider(cmd.Context(), cfg.Commons.TracesExporter, cfg.Service.Name) if err != nil { logger.Error().Err(err).Msg("Failed to initialize tracer") diff --git a/services/activitylog/pkg/config/config.go b/services/activitylog/pkg/config/config.go index d518bffca..6497b1d90 100644 --- a/services/activitylog/pkg/config/config.go +++ b/services/activitylog/pkg/config/config.go @@ -13,7 +13,8 @@ type Config struct { Service Service `yaml:"-"` - Log *Log `yaml:"log"` + LogLevel string `mapstructure:"loglevel" env:"OC_LOG_LEVEL;ACTIVITYLOG_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + Debug Debug `yaml:"debug"` Events Events `yaml:"events"` diff --git a/services/activitylog/pkg/config/defaults/defaultconfig.go b/services/activitylog/pkg/config/defaults/defaultconfig.go index a6da0cf29..7265cd56e 100644 --- a/services/activitylog/pkg/config/defaults/defaultconfig.go +++ b/services/activitylog/pkg/config/defaults/defaultconfig.go @@ -59,18 +59,9 @@ func DefaultConfig() *config.Config { // EnsureDefaults ensures the config contains default values func EnsureDefaults(cfg *config.Config) { - // provide with defaults for shared logging, since we need a valid destination address for "envdecode". - 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" } - if cfg.GRPCClientTLS == nil && cfg.Commons != nil { cfg.GRPCClientTLS = structs.CopyOrZeroValue(cfg.Commons.GRPCClientTLS) } diff --git a/services/activitylog/pkg/config/log.go b/services/activitylog/pkg/config/log.go deleted file mode 100644 index cd5e4cb10..000000000 --- a/services/activitylog/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;ACTIVITYLOG_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;ACTIVITYLOG_LOG_PRETTY" desc:"Activates pretty log output." introductionVersion:"1.0.0"` - Color bool `mapstructure:"color" env:"OC_LOG_COLOR;ACTIVITYLOG_LOG_COLOR" desc:"Activates colorized log output." introductionVersion:"1.0.0"` - File string `mapstructure:"file" env:"OC_LOG_FILE;ACTIVITYLOG_LOG_FILE" desc:"The path to the log file. Activates logging to this file if set." introductionVersion:"1.0.0"` -} diff --git a/services/activitylog/pkg/logging/logging.go b/services/activitylog/pkg/logging/logging.go deleted file mode 100644 index 7994b741a..000000000 --- a/services/activitylog/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/activitylog/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), - ) -} From 4883496527854ca3324a2fbc108555eefb534ab3 Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Wed, 7 Jan 2026 17:18:10 +0100 Subject: [PATCH 02/45] move log configure function to global log package Signed-off-by: Christian Richter --- pkg/log/config.go | 14 ++++++++++++++ pkg/shared/logging.go | 14 -------------- services/activitylog/pkg/command/server.go | 4 ++-- 3 files changed, 16 insertions(+), 16 deletions(-) create mode 100644 pkg/log/config.go delete mode 100644 pkg/shared/logging.go diff --git a/pkg/log/config.go b/pkg/log/config.go new file mode 100644 index 000000000..0bb4db1b5 --- /dev/null +++ b/pkg/log/config.go @@ -0,0 +1,14 @@ +package log + +import "github.com/opencloud-eu/opencloud/pkg/shared" + +// Configure initializes a service-specific logger instance. +func Configure(name string, commons *shared.Commons, localServiceLogLevel string) Logger { + return NewLogger( + Name(name), + Level(localServiceLogLevel), + Pretty(commons.Log.Pretty), + Color(commons.Log.Color), + File(commons.Log.File), + ) +} diff --git a/pkg/shared/logging.go b/pkg/shared/logging.go deleted file mode 100644 index b774b1884..000000000 --- a/pkg/shared/logging.go +++ /dev/null @@ -1,14 +0,0 @@ -package shared - -import "github.com/opencloud-eu/opencloud/pkg/log" - -// Configure initializes a service-specific logger instance. -func Configure(name string, commons *Commons, localServiceLogLevel string) log.Logger { - return log.NewLogger( - log.Name(name), - log.Level(localServiceLogLevel), - log.Pretty(commons.Log.Pretty), - log.Color(commons.Log.Color), - log.File(commons.Log.File), - ) -} diff --git a/services/activitylog/pkg/command/server.go b/services/activitylog/pkg/command/server.go index c7aed3e9b..8f95d481f 100644 --- a/services/activitylog/pkg/command/server.go +++ b/services/activitylog/pkg/command/server.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/oklog/run" - "github.com/opencloud-eu/opencloud/pkg/shared" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/reva/v2/pkg/events" "github.com/opencloud-eu/reva/v2/pkg/events/stream" "github.com/opencloud-eu/reva/v2/pkg/rgrpc/todo/pool" @@ -55,7 +55,7 @@ func Server(cfg *config.Config) *cobra.Command { return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, RunE: func(cmd *cobra.Command, args []string) error { - logger := shared.Configure(cfg.Service.Name, cfg.Commons, cfg.LogLevel) + logger := log.Configure(cfg.Service.Name, cfg.Commons, cfg.LogLevel) tracerProvider, err := tracing.GetTraceProvider(cmd.Context(), cfg.Commons.TracesExporter, cfg.Service.Name) if err != nil { logger.Error().Err(err).Msg("Failed to initialize tracer") From 2229fb36f59d872a27aa907415aa2d624c21787e Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Thu, 8 Jan 2026 11:19:41 +0100 Subject: [PATCH 03/45] consolidate log config in antivirus Signed-off-by: Christian Richter --- services/antivirus/pkg/command/health.go | 8 +------- services/antivirus/pkg/command/server.go | 9 +-------- services/antivirus/pkg/config/config.go | 14 +++----------- .../antivirus/pkg/config/defaults/defaultconfig.go | 4 ++-- 4 files changed, 7 insertions(+), 28 deletions(-) diff --git a/services/antivirus/pkg/command/health.go b/services/antivirus/pkg/command/health.go index 937f7b2df..a3c5df8de 100644 --- a/services/antivirus/pkg/command/health.go +++ b/services/antivirus/pkg/command/health.go @@ -21,13 +21,7 @@ func Health(cfg *config.Config) *cobra.Command { return configlog.ReturnError(parser.ParseConfig(cfg)) }, RunE: func(cmd *cobra.Command, args []string) error { - logger := log.NewLogger( - log.Name(cfg.Service.Name), - log.Level(cfg.Log.Level), - log.Pretty(cfg.Log.Pretty), - log.Color(cfg.Log.Color), - log.File(cfg.Log.File), - ) + logger := log.Configure(cfg.Service.Name, cfg.Commons, cfg.LogLevel) resp, err := http.Get( fmt.Sprintf( diff --git a/services/antivirus/pkg/command/server.go b/services/antivirus/pkg/command/server.go index dd6aa6e22..283bbd093 100644 --- a/services/antivirus/pkg/command/server.go +++ b/services/antivirus/pkg/command/server.go @@ -32,14 +32,7 @@ func Server(cfg *config.Config) *cobra.Command { defer cancel() } ctx := cfg.Context - - logger := log.NewLogger( - log.Name(cfg.Service.Name), - log.Level(cfg.Log.Level), - log.Pretty(cfg.Log.Pretty), - log.Color(cfg.Log.Color), - log.File(cfg.Log.File), - ) + logger := log.Configure(cfg.Service.Name, cfg.Commons, cfg.LogLevel) traceProvider, err := tracing.GetTraceProvider(cmd.Context(), cfg.Commons.TracesExporter, cfg.Service.Name) if err != nil { diff --git a/services/antivirus/pkg/config/config.go b/services/antivirus/pkg/config/config.go index c0a25c090..5e7266b5d 100644 --- a/services/antivirus/pkg/config/config.go +++ b/services/antivirus/pkg/config/config.go @@ -29,9 +29,9 @@ const ( // Config combines all available configuration parts. type Config struct { - Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service - File string - Log *Log + Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service + File string + LogLevel string `mapstructure:"level" env:"OC_LOG_LEVEL;ANTIVIRUS_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` Debug Debug `yaml:"debug" mask:"struct"` @@ -55,14 +55,6 @@ type Service struct { Name string `yaml:"-"` } -// Log defines the available log configuration. -type Log struct { - Level string `mapstructure:"level" env:"OC_LOG_LEVEL;ANTIVIRUS_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;ANTIVIRUS_LOG_PRETTY" desc:"Activates pretty log output." introductionVersion:"1.0.0"` - Color bool `mapstructure:"color" env:"OC_LOG_COLOR;ANTIVIRUS_LOG_COLOR" desc:"Activates colorized log output." introductionVersion:"1.0.0"` - File string `mapstructure:"file" env:"OC_LOG_FILE;ANTIVIRUS_LOG_FILE" desc:"The path to the log file. Activates logging to this file if set." introductionVersion:"1.0.0"` -} - // Debug defines the available debug configuration. type Debug struct { Addr string `yaml:"addr" env:"ANTIVIRUS_DEBUG_ADDR" desc:"Bind address of the debug server, where metrics, health, config and debug endpoints will be exposed." introductionVersion:"1.0.0"` diff --git a/services/antivirus/pkg/config/defaults/defaultconfig.go b/services/antivirus/pkg/config/defaults/defaultconfig.go index 446e7c215..7b912d588 100644 --- a/services/antivirus/pkg/config/defaults/defaultconfig.go +++ b/services/antivirus/pkg/config/defaults/defaultconfig.go @@ -51,8 +51,8 @@ func DefaultConfig() *config.Config { // EnsureDefaults adds default values to the configuration if they are not set yet func EnsureDefaults(cfg *config.Config) { - if cfg.Log == nil { - cfg.Log = &config.Log{} + if cfg.LogLevel == "" { + cfg.LogLevel = "error" } } From 36b5988068c2020335ecd43cb14c611930568369 Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Thu, 8 Jan 2026 11:23:58 +0100 Subject: [PATCH 04/45] consolidate log config in app-provider Signed-off-by: Christian Richter --- services/app-provider/pkg/command/health.go | 4 ++-- services/app-provider/pkg/command/server.go | 4 ++-- services/app-provider/pkg/config/config.go | 15 ++++----------- .../pkg/config/defaults/defaultconfig.go | 12 ++---------- services/app-provider/pkg/logging/logging.go | 17 ----------------- 5 files changed, 10 insertions(+), 42 deletions(-) delete mode 100644 services/app-provider/pkg/logging/logging.go diff --git a/services/app-provider/pkg/command/health.go b/services/app-provider/pkg/command/health.go index 9668bd4cd..e1daa95b0 100644 --- a/services/app-provider/pkg/command/health.go +++ b/services/app-provider/pkg/command/health.go @@ -5,9 +5,9 @@ import ( "net/http" "github.com/opencloud-eu/opencloud/pkg/config/configlog" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/services/app-provider/pkg/config" "github.com/opencloud-eu/opencloud/services/app-provider/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/app-provider/pkg/logging" "github.com/spf13/cobra" ) @@ -20,7 +20,7 @@ func Health(cfg *config.Config) *cobra.Command { return configlog.ReturnError(parser.ParseConfig(cfg)) }, 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) resp, err := http.Get( fmt.Sprintf( diff --git a/services/app-provider/pkg/command/server.go b/services/app-provider/pkg/command/server.go index a615dd0c4..e30343995 100644 --- a/services/app-provider/pkg/command/server.go +++ b/services/app-provider/pkg/command/server.go @@ -5,6 +5,7 @@ import ( "fmt" "os/signal" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/reva/v2/cmd/revad/runtime" "github.com/spf13/cobra" @@ -15,7 +16,6 @@ import ( "github.com/opencloud-eu/opencloud/pkg/version" "github.com/opencloud-eu/opencloud/services/app-provider/pkg/config" "github.com/opencloud-eu/opencloud/services/app-provider/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/app-provider/pkg/logging" "github.com/opencloud-eu/opencloud/services/app-provider/pkg/revaconfig" "github.com/opencloud-eu/opencloud/services/app-provider/pkg/server/debug" ) @@ -29,7 +29,7 @@ func Server(cfg *config.Config) *cobra.Command { return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, 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) traceProvider, err := tracing.GetTraceProvider(cmd.Context(), cfg.Commons.TracesExporter, cfg.Service.Name) if err != nil { return err diff --git a/services/app-provider/pkg/config/config.go b/services/app-provider/pkg/config/config.go index ee89e5608..bcf35f7e1 100644 --- a/services/app-provider/pkg/config/config.go +++ b/services/app-provider/pkg/config/config.go @@ -7,10 +7,10 @@ import ( ) type Config struct { - Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service - Service Service `yaml:"-"` - Log *Log `yaml:"log"` - Debug Debug `yaml:"debug"` + Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service + Service Service `yaml:"-"` + LogLevel string `yaml:"level" env:"OC_LOG_LEVEL;APP_PROVIDER_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + Debug Debug `yaml:"debug"` GRPC GRPCConfig `yaml:"grpc"` @@ -24,13 +24,6 @@ type Config struct { Context context.Context `yaml:"-"` } -type Log struct { - Level string `yaml:"level" env:"OC_LOG_LEVEL;APP_PROVIDER_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` - Pretty bool `yaml:"pretty" env:"OC_LOG_PRETTY;APP_PROVIDER_LOG_PRETTY" desc:"Activates pretty log output." introductionVersion:"1.0.0"` - Color bool `yaml:"color" env:"OC_LOG_COLOR;APP_PROVIDER_LOG_COLOR" desc:"Activates colorized log output." introductionVersion:"1.0.0"` - File string `yaml:"file" env:"OC_LOG_FILE;APP_PROVIDER_LOG_FILE" desc:"The path to the log file. Activates logging to this file if set." introductionVersion:"1.0.0"` -} - type Debug struct { Addr string `yaml:"addr" env:"APP_PROVIDER_DEBUG_ADDR" desc:"Bind address of the debug server, where metrics, health, config and debug endpoints will be exposed." introductionVersion:"1.0.0"` Token string `yaml:"token" env:"APP_PROVIDER_DEBUG_TOKEN" desc:"Token to secure the metrics endpoint" introductionVersion:"1.0.0"` diff --git a/services/app-provider/pkg/config/defaults/defaultconfig.go b/services/app-provider/pkg/config/defaults/defaultconfig.go index c33e6db4c..4c9d64d38 100644 --- a/services/app-provider/pkg/config/defaults/defaultconfig.go +++ b/services/app-provider/pkg/config/defaults/defaultconfig.go @@ -45,16 +45,8 @@ func DefaultConfig() *config.Config { // EnsureDefaults adds default values to the configuration if they are not set yet func EnsureDefaults(cfg *config.Config) { - // provide with defaults for shared logging, since we need a valid destination address for "envdecode". - 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" } if cfg.Reva == nil && cfg.Commons != nil { diff --git a/services/app-provider/pkg/logging/logging.go b/services/app-provider/pkg/logging/logging.go deleted file mode 100644 index c131825be..000000000 --- a/services/app-provider/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/app-provider/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), - ) -} From 234c9bf1a7498b677663cf3b0f33480bc351df3f Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Thu, 8 Jan 2026 11:48:09 +0100 Subject: [PATCH 05/45] consolidate log config in app-registry Signed-off-by: Christian Richter --- services/app-registry/pkg/command/health.go | 5 +++-- services/app-registry/pkg/command/server.go | 5 +++-- services/app-registry/pkg/config/config.go | 14 ++++---------- .../pkg/config/defaults/defaultconfig.go | 12 ++---------- services/app-registry/pkg/logging/logging.go | 17 ----------------- 5 files changed, 12 insertions(+), 41 deletions(-) delete mode 100644 services/app-registry/pkg/logging/logging.go diff --git a/services/app-registry/pkg/command/health.go b/services/app-registry/pkg/command/health.go index e4389443e..bca9cedac 100644 --- a/services/app-registry/pkg/command/health.go +++ b/services/app-registry/pkg/command/health.go @@ -5,9 +5,10 @@ import ( "net/http" "github.com/opencloud-eu/opencloud/pkg/config/configlog" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/services/app-registry/pkg/config" "github.com/opencloud-eu/opencloud/services/app-registry/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/app-registry/pkg/logging" + "github.com/spf13/cobra" ) @@ -20,7 +21,7 @@ func Health(cfg *config.Config) *cobra.Command { return configlog.ReturnError(parser.ParseConfig(cfg)) }, 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) resp, err := http.Get( fmt.Sprintf( diff --git a/services/app-registry/pkg/command/server.go b/services/app-registry/pkg/command/server.go index 4b11c872b..e94d2e6a4 100644 --- a/services/app-registry/pkg/command/server.go +++ b/services/app-registry/pkg/command/server.go @@ -6,16 +6,17 @@ import ( "os/signal" "github.com/opencloud-eu/opencloud/pkg/config/configlog" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/pkg/registry" "github.com/opencloud-eu/opencloud/pkg/runner" "github.com/opencloud-eu/opencloud/pkg/tracing" "github.com/opencloud-eu/opencloud/pkg/version" "github.com/opencloud-eu/opencloud/services/app-registry/pkg/config" "github.com/opencloud-eu/opencloud/services/app-registry/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/app-registry/pkg/logging" "github.com/opencloud-eu/opencloud/services/app-registry/pkg/revaconfig" "github.com/opencloud-eu/opencloud/services/app-registry/pkg/server/debug" "github.com/opencloud-eu/reva/v2/cmd/revad/runtime" + "github.com/spf13/cobra" ) @@ -28,7 +29,7 @@ func Server(cfg *config.Config) *cobra.Command { return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, 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) traceProvider, err := tracing.GetTraceProvider(cmd.Context(), cfg.Commons.TracesExporter, cfg.Service.Name) if err != nil { return err diff --git a/services/app-registry/pkg/config/config.go b/services/app-registry/pkg/config/config.go index a32386e8f..3aeb1ce3a 100644 --- a/services/app-registry/pkg/config/config.go +++ b/services/app-registry/pkg/config/config.go @@ -9,9 +9,10 @@ import ( type Config struct { Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service - Service Service `yaml:"-"` - Log *Log `yaml:"log"` - Debug Debug `yaml:"debug"` + Service Service `yaml:"-"` + LogLevel string `yaml:"level" env:"OC_LOG_LEVEL;APP_REGISTRY_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + + Debug Debug `yaml:"debug"` GRPC GRPCConfig `yaml:"grpc"` @@ -23,13 +24,6 @@ type Config struct { Context context.Context `yaml:"-"` } -type Log struct { - Level string `yaml:"level" env:"OC_LOG_LEVEL;APP_REGISTRY_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` - Pretty bool `yaml:"pretty" env:"OC_LOG_PRETTY;APP_REGISTRY_LOG_PRETTY" desc:"Activates pretty log output." introductionVersion:"1.0.0"` - Color bool `yaml:"color" env:"OC_LOG_COLOR;APP_REGISTRY_LOG_COLOR" desc:"Activates colorized log output." introductionVersion:"1.0.0"` - File string `yaml:"file" env:"OC_LOG_FILE;APP_REGISTRY_LOG_FILE" desc:"The path to the log file. Activates logging to this file if set." introductionVersion:"1.0.0"` -} - type Service struct { Name string `yaml:"-"` } diff --git a/services/app-registry/pkg/config/defaults/defaultconfig.go b/services/app-registry/pkg/config/defaults/defaultconfig.go index 8bab2a9fb..f04016b47 100644 --- a/services/app-registry/pkg/config/defaults/defaultconfig.go +++ b/services/app-registry/pkg/config/defaults/defaultconfig.go @@ -122,16 +122,8 @@ func defaultMimeTypeConfig() []config.MimeTypeConfig { // EnsureDefaults adds default values to the configuration if they are not set yet func EnsureDefaults(cfg *config.Config) { - // provide with defaults for shared logging, since we need a valid destination address for "envdecode". - 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" } if cfg.Reva == nil && cfg.Commons != nil { diff --git a/services/app-registry/pkg/logging/logging.go b/services/app-registry/pkg/logging/logging.go deleted file mode 100644 index 5431a66b8..000000000 --- a/services/app-registry/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/app-registry/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), - ) -} From 587e3c76ff0c649e47470cbe13aaadb8391a52dc Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Thu, 8 Jan 2026 11:50:54 +0100 Subject: [PATCH 06/45] consolidate log config in audit Signed-off-by: Christian Richter --- services/audit/pkg/command/server.go | 5 ++--- services/audit/pkg/config/config.go | 10 ++++------ .../audit/pkg/config/defaults/defaultconfig.go | 12 ++---------- services/audit/pkg/config/log.go | 9 --------- services/audit/pkg/logging/logging.go | 17 ----------------- 5 files changed, 8 insertions(+), 45 deletions(-) delete mode 100644 services/audit/pkg/config/log.go delete mode 100644 services/audit/pkg/logging/logging.go diff --git a/services/audit/pkg/command/server.go b/services/audit/pkg/command/server.go index 4ce05241d..3ebc61044 100644 --- a/services/audit/pkg/command/server.go +++ b/services/audit/pkg/command/server.go @@ -7,10 +7,10 @@ import ( "github.com/opencloud-eu/opencloud/pkg/config/configlog" "github.com/opencloud-eu/opencloud/pkg/generators" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/pkg/runner" "github.com/opencloud-eu/opencloud/services/audit/pkg/config" "github.com/opencloud-eu/opencloud/services/audit/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/audit/pkg/logging" "github.com/opencloud-eu/opencloud/services/audit/pkg/server/debug" svc "github.com/opencloud-eu/opencloud/services/audit/pkg/service" "github.com/opencloud-eu/opencloud/services/audit/pkg/types" @@ -35,8 +35,7 @@ func Server(cfg *config.Config) *cobra.Command { defer cancel() } ctx := cfg.Context - - logger := logging.Configure(cfg.Service.Name, cfg.Log) + logger := log.Configure(cfg.Service.Name, cfg.Commons, cfg.LogLevel) gr := runner.NewGroup() connName := generators.GenerateConnectionName(cfg.Service.Name, generators.NTypeBus) diff --git a/services/audit/pkg/config/config.go b/services/audit/pkg/config/config.go index c98fd9f21..37c5f9b6c 100644 --- a/services/audit/pkg/config/config.go +++ b/services/audit/pkg/config/config.go @@ -8,12 +8,10 @@ import ( // Config combines all available configuration parts. type Config struct { - Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service - - Service Service `yaml:"-"` - - Log *Log `yaml:"log"` - Debug Debug `yaml:"debug"` + Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service + Service Service `yaml:"-"` + LogLevel string `yaml:"level" env:"OC_LOG_LEVEL;AUDIT_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + Debug Debug `yaml:"debug"` Events Events `yaml:"events"` Auditlog Auditlog `yaml:"auditlog"` diff --git a/services/audit/pkg/config/defaults/defaultconfig.go b/services/audit/pkg/config/defaults/defaultconfig.go index 20d881892..0dbc9e5fd 100644 --- a/services/audit/pkg/config/defaults/defaultconfig.go +++ b/services/audit/pkg/config/defaults/defaultconfig.go @@ -37,16 +37,8 @@ func DefaultConfig() *config.Config { // EnsureDefaults adds default values to the configuration if they are not set yet func EnsureDefaults(cfg *config.Config) { - // provide with defaults for shared logging, since we need a valid destination address for "envdecode". - 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" } } diff --git a/services/audit/pkg/config/log.go b/services/audit/pkg/config/log.go deleted file mode 100644 index c9ffe7c97..000000000 --- a/services/audit/pkg/config/log.go +++ /dev/null @@ -1,9 +0,0 @@ -package config - -// Log defines the available log configuration. -type Log struct { - Level string `yaml:"level" env:"OC_LOG_LEVEL;AUDIT_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` - Pretty bool `yaml:"pretty" env:"OC_LOG_PRETTY;AUDIT_LOG_PRETTY" desc:"Activates pretty log output." introductionVersion:"1.0.0"` - Color bool `yaml:"color" env:"OC_LOG_COLOR;AUDIT_LOG_COLOR" desc:"Activates colorized log output." introductionVersion:"1.0.0"` - File string `yaml:"file" env:"OC_LOG_FILE;AUDIT_LOG_FILE" desc:"The path to the log file. Activates logging to this file if set." introductionVersion:"1.0.0"` -} diff --git a/services/audit/pkg/logging/logging.go b/services/audit/pkg/logging/logging.go deleted file mode 100644 index 9387cf2c0..000000000 --- a/services/audit/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/audit/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), - ) -} From b3e448bf5b37254e1e58d310f2c22b7a5d26425b Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Thu, 8 Jan 2026 11:53:44 +0100 Subject: [PATCH 07/45] consolidate log config in auth-app Signed-off-by: Christian Richter --- services/auth-app/pkg/command/health.go | 4 ++-- services/auth-app/pkg/command/server.go | 4 ++-- services/auth-app/pkg/config/config.go | 16 ++++------------ .../pkg/config/defaults/defaultconfig.go | 12 ++---------- services/auth-app/pkg/logging/logging.go | 17 ----------------- 5 files changed, 10 insertions(+), 43 deletions(-) delete mode 100644 services/auth-app/pkg/logging/logging.go diff --git a/services/auth-app/pkg/command/health.go b/services/auth-app/pkg/command/health.go index fac1ec71a..9082c54b0 100644 --- a/services/auth-app/pkg/command/health.go +++ b/services/auth-app/pkg/command/health.go @@ -5,9 +5,9 @@ import ( "net/http" "github.com/opencloud-eu/opencloud/pkg/config/configlog" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/services/auth-app/pkg/config" "github.com/opencloud-eu/opencloud/services/auth-app/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/auth-app/pkg/logging" "github.com/spf13/cobra" ) @@ -21,7 +21,7 @@ func Health(cfg *config.Config) *cobra.Command { return configlog.ReturnError(parser.ParseConfig(cfg)) }, 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) resp, err := http.Get( fmt.Sprintf( diff --git a/services/auth-app/pkg/command/server.go b/services/auth-app/pkg/command/server.go index 276bef46d..ed8d87f33 100644 --- a/services/auth-app/pkg/command/server.go +++ b/services/auth-app/pkg/command/server.go @@ -6,6 +6,7 @@ import ( "os/signal" "github.com/opencloud-eu/opencloud/pkg/config/configlog" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/pkg/registry" "github.com/opencloud-eu/opencloud/pkg/runner" ogrpc "github.com/opencloud-eu/opencloud/pkg/service/grpc" @@ -14,7 +15,6 @@ import ( settingssvc "github.com/opencloud-eu/opencloud/protogen/gen/opencloud/services/settings/v0" "github.com/opencloud-eu/opencloud/services/auth-app/pkg/config" "github.com/opencloud-eu/opencloud/services/auth-app/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/auth-app/pkg/logging" "github.com/opencloud-eu/opencloud/services/auth-app/pkg/revaconfig" "github.com/opencloud-eu/opencloud/services/auth-app/pkg/server/debug" "github.com/opencloud-eu/opencloud/services/auth-app/pkg/server/http" @@ -37,7 +37,7 @@ func Server(cfg *config.Config) *cobra.Command { fmt.Println("WARNING: Impersonation is enabled. Admins can impersonate all users.") } - logger := logging.Configure(cfg.Service.Name, cfg.Log) + logger := log.Configure(cfg.Service.Name, cfg.Commons, cfg.LogLevel) traceProvider, err := tracing.GetTraceProvider(cmd.Context(), cfg.Commons.TracesExporter, cfg.Service.Name) if err != nil { return err diff --git a/services/auth-app/pkg/config/config.go b/services/auth-app/pkg/config/config.go index 0ec52de4a..9cda13a36 100644 --- a/services/auth-app/pkg/config/config.go +++ b/services/auth-app/pkg/config/config.go @@ -8,10 +8,10 @@ import ( // Config defines the root config structure type Config struct { - Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service - Service Service `yaml:"-"` - Log *Log `yaml:"log"` - Debug Debug `yaml:"debug"` + Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service + Service Service `yaml:"-"` + LogLevel string `yaml:"level" env:"OC_LOG_LEVEL;AUTH_APP_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + Debug Debug `yaml:"debug"` GRPC GRPCConfig `yaml:"grpc"` HTTP HTTP `yaml:"http"` @@ -61,14 +61,6 @@ type RandPWOpts struct { PasswordLength int `yaml:"password_length" env:"AUTH_APP_JSONCS3_RANDOM_PASSWORD_LENGTH" desc:"The number of charactors the generated passwords will have." introductionVersion:"4.0.0"` } -// Log defines the loging configuration -type Log struct { - Level string `yaml:"level" env:"OC_LOG_LEVEL;AUTH_APP_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` - Pretty bool `yaml:"pretty" env:"OC_LOG_PRETTY;AUTH_APP_LOG_PRETTY" desc:"Activates pretty log output." introductionVersion:"1.0.0"` - Color bool `yaml:"color" env:"OC_LOG_COLOR;AUTH_APP_LOG_COLOR" desc:"Activates colorized log output." introductionVersion:"1.0.0"` - File string `yaml:"file" env:"OC_LOG_FILE;AUTH_APP_LOG_FILE" desc:"The path to the log file. Activates logging to this file if set." introductionVersion:"1.0.0"` -} - // Service defines the service configuration type Service struct { Name string `yaml:"-"` diff --git a/services/auth-app/pkg/config/defaults/defaultconfig.go b/services/auth-app/pkg/config/defaults/defaultconfig.go index 3acce5d06..9bce1f8c0 100644 --- a/services/auth-app/pkg/config/defaults/defaultconfig.go +++ b/services/auth-app/pkg/config/defaults/defaultconfig.go @@ -63,16 +63,8 @@ func DefaultConfig() *config.Config { // EnsureDefaults adds default values to the configuration if they are not set yet func EnsureDefaults(cfg *config.Config) { - // provide with defaults for shared logging, since we need a valid destination address for "envdecode". - 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" } if cfg.GRPCClientTLS == nil && cfg.Commons != nil { diff --git a/services/auth-app/pkg/logging/logging.go b/services/auth-app/pkg/logging/logging.go deleted file mode 100644 index f9af2a136..000000000 --- a/services/auth-app/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/auth-app/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), - ) -} From 99ff445db7136dd3c53a79034d038c1ea0272e15 Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Thu, 8 Jan 2026 11:56:07 +0100 Subject: [PATCH 08/45] consolidate log config in auth-basic Signed-off-by: Christian Richter --- services/auth-basic/pkg/command/health.go | 4 ++-- services/auth-basic/pkg/command/server.go | 4 ++-- services/auth-basic/pkg/config/config.go | 15 ++++----------- .../pkg/config/defaults/defaultconfig.go | 13 ++----------- services/auth-basic/pkg/logging/logging.go | 17 ----------------- 5 files changed, 10 insertions(+), 43 deletions(-) delete mode 100644 services/auth-basic/pkg/logging/logging.go diff --git a/services/auth-basic/pkg/command/health.go b/services/auth-basic/pkg/command/health.go index 86c475cd8..9eab03f1d 100644 --- a/services/auth-basic/pkg/command/health.go +++ b/services/auth-basic/pkg/command/health.go @@ -5,9 +5,9 @@ import ( "net/http" "github.com/opencloud-eu/opencloud/pkg/config/configlog" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/services/auth-basic/pkg/config" "github.com/opencloud-eu/opencloud/services/auth-basic/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/auth-basic/pkg/logging" "github.com/spf13/cobra" ) @@ -21,7 +21,7 @@ func Health(cfg *config.Config) *cobra.Command { return configlog.ReturnError(parser.ParseConfig(cfg)) }, 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) resp, err := http.Get( fmt.Sprintf( diff --git a/services/auth-basic/pkg/command/server.go b/services/auth-basic/pkg/command/server.go index e690533e1..48cee21a1 100644 --- a/services/auth-basic/pkg/command/server.go +++ b/services/auth-basic/pkg/command/server.go @@ -7,13 +7,13 @@ import ( "github.com/opencloud-eu/opencloud/pkg/config/configlog" "github.com/opencloud-eu/opencloud/pkg/ldap" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/pkg/registry" "github.com/opencloud-eu/opencloud/pkg/runner" "github.com/opencloud-eu/opencloud/pkg/tracing" "github.com/opencloud-eu/opencloud/pkg/version" "github.com/opencloud-eu/opencloud/services/auth-basic/pkg/config" "github.com/opencloud-eu/opencloud/services/auth-basic/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/auth-basic/pkg/logging" "github.com/opencloud-eu/opencloud/services/auth-basic/pkg/revaconfig" "github.com/opencloud-eu/opencloud/services/auth-basic/pkg/server/debug" "github.com/opencloud-eu/reva/v2/cmd/revad/runtime" @@ -30,7 +30,7 @@ func Server(cfg *config.Config) *cobra.Command { return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, 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) traceProvider, err := tracing.GetTraceProvider(cmd.Context(), cfg.Commons.TracesExporter, cfg.Service.Name) if err != nil { return err diff --git a/services/auth-basic/pkg/config/config.go b/services/auth-basic/pkg/config/config.go index b9235895e..45b75d50a 100644 --- a/services/auth-basic/pkg/config/config.go +++ b/services/auth-basic/pkg/config/config.go @@ -7,10 +7,10 @@ import ( ) type Config struct { - Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service - Service Service `yaml:"-"` - Log *Log `yaml:"log"` - Debug Debug `yaml:"debug"` + Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service + Service Service `yaml:"-"` + LogLevel string `yaml:"level" env:"OC_LOG_LEVEL;AUTH_BASIC_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + Debug Debug `yaml:"debug"` GRPC GRPCConfig `yaml:"grpc"` @@ -24,13 +24,6 @@ type Config struct { Context context.Context `yaml:"-"` } -type Log struct { - Level string `yaml:"level" env:"OC_LOG_LEVEL;AUTH_BASIC_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` - Pretty bool `yaml:"pretty" env:"OC_LOG_PRETTY;AUTH_BASIC_LOG_PRETTY" desc:"Activates pretty log output." introductionVersion:"1.0.0"` - Color bool `yaml:"color" env:"OC_LOG_COLOR;AUTH_BASIC_LOG_COLOR" desc:"Activates colorized log output." introductionVersion:"1.0.0"` - File string `yaml:"file" env:"OC_LOG_FILE;AUTH_BASIC_LOG_FILE" desc:"The path to the log file. Activates logging to this file if set." introductionVersion:"1.0.0"` -} - type Service struct { Name string `yaml:"-"` } diff --git a/services/auth-basic/pkg/config/defaults/defaultconfig.go b/services/auth-basic/pkg/config/defaults/defaultconfig.go index 01f53a27a..04bdf4aca 100644 --- a/services/auth-basic/pkg/config/defaults/defaultconfig.go +++ b/services/auth-basic/pkg/config/defaults/defaultconfig.go @@ -86,18 +86,9 @@ func DefaultConfig() *config.Config { // EnsureDefaults adds default values to the configuration if they are not set yet func EnsureDefaults(cfg *config.Config) { - // provide with defaults for shared logging, since we need a valid destination address for "envdecode". - 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" } - if cfg.Reva == nil && cfg.Commons != nil { cfg.Reva = structs.CopyOrZeroValue(cfg.Commons.Reva) } diff --git a/services/auth-basic/pkg/logging/logging.go b/services/auth-basic/pkg/logging/logging.go deleted file mode 100644 index 61132103e..000000000 --- a/services/auth-basic/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/auth-basic/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), - ) -} From ea415ab364c357e3a542c48e61f4d5832b47abd2 Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Thu, 8 Jan 2026 11:58:56 +0100 Subject: [PATCH 09/45] consolidate log config in auth-bearer Signed-off-by: Christian Richter --- services/auth-bearer/pkg/command/health.go | 4 ++-- services/auth-bearer/pkg/command/server.go | 4 ++-- services/auth-bearer/pkg/config/config.go | 16 +++++----------- .../pkg/config/defaults/defaultconfig.go | 12 ++---------- services/auth-bearer/pkg/logging/logging.go | 17 ----------------- 5 files changed, 11 insertions(+), 42 deletions(-) delete mode 100644 services/auth-bearer/pkg/logging/logging.go diff --git a/services/auth-bearer/pkg/command/health.go b/services/auth-bearer/pkg/command/health.go index 967dedd48..bfd2e6836 100644 --- a/services/auth-bearer/pkg/command/health.go +++ b/services/auth-bearer/pkg/command/health.go @@ -5,9 +5,9 @@ import ( "net/http" "github.com/opencloud-eu/opencloud/pkg/config/configlog" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/services/auth-bearer/pkg/config" "github.com/opencloud-eu/opencloud/services/auth-bearer/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/auth-bearer/pkg/logging" "github.com/spf13/cobra" ) @@ -21,7 +21,7 @@ func Health(cfg *config.Config) *cobra.Command { return configlog.ReturnError(parser.ParseConfig(cfg)) }, 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) resp, err := http.Get( fmt.Sprintf( diff --git a/services/auth-bearer/pkg/command/server.go b/services/auth-bearer/pkg/command/server.go index aeab79824..8339354d6 100644 --- a/services/auth-bearer/pkg/command/server.go +++ b/services/auth-bearer/pkg/command/server.go @@ -6,13 +6,13 @@ import ( "os/signal" "github.com/opencloud-eu/opencloud/pkg/config/configlog" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/pkg/registry" "github.com/opencloud-eu/opencloud/pkg/runner" "github.com/opencloud-eu/opencloud/pkg/tracing" "github.com/opencloud-eu/opencloud/pkg/version" "github.com/opencloud-eu/opencloud/services/auth-bearer/pkg/config" "github.com/opencloud-eu/opencloud/services/auth-bearer/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/auth-bearer/pkg/logging" "github.com/opencloud-eu/opencloud/services/auth-bearer/pkg/revaconfig" "github.com/opencloud-eu/opencloud/services/auth-bearer/pkg/server/debug" "github.com/opencloud-eu/reva/v2/cmd/revad/runtime" @@ -29,7 +29,7 @@ func Server(cfg *config.Config) *cobra.Command { return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, 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) traceProvider, err := tracing.GetTraceProvider(cmd.Context(), cfg.Commons.TracesExporter, cfg.Service.Name) if err != nil { return err diff --git a/services/auth-bearer/pkg/config/config.go b/services/auth-bearer/pkg/config/config.go index 688736289..6eaa972f5 100644 --- a/services/auth-bearer/pkg/config/config.go +++ b/services/auth-bearer/pkg/config/config.go @@ -7,10 +7,11 @@ import ( ) type Config struct { - Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service - Service Service `yaml:"-"` - Log *Log `yaml:"log"` - Debug Debug `yaml:"debug"` + Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service + Service Service `yaml:"-"` + LogLevel string `yaml:"level" env:"OC_LOG_LEVEL;AUTH_BEARER_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + + Debug Debug `yaml:"debug"` GRPC GRPCConfig `yaml:"grpc"` @@ -24,13 +25,6 @@ type Config struct { Context context.Context `yaml:"-"` } -type Log struct { - Level string `yaml:"level" env:"OC_LOG_LEVEL;AUTH_BEARER_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` - Pretty bool `yaml:"pretty" env:"OC_LOG_PRETTY;AUTH_BEARER_LOG_PRETTY" desc:"Activates pretty log output." introductionVersion:"1.0.0"` - Color bool `yaml:"color" env:"OC_LOG_COLOR;AUTH_BEARER_LOG_COLOR" desc:"Activates colorized log output." introductionVersion:"1.0.0"` - File string `yaml:"file" env:"OC_LOG_FILE;AUTH_BEARER_LOG_FILE" desc:"The path to the log file. Activates logging to this file if set." introductionVersion:"1.0.0"` -} - type Service struct { Name string `yaml:"-"` } diff --git a/services/auth-bearer/pkg/config/defaults/defaultconfig.go b/services/auth-bearer/pkg/config/defaults/defaultconfig.go index 8bc9c99d9..5c4ac9a06 100644 --- a/services/auth-bearer/pkg/config/defaults/defaultconfig.go +++ b/services/auth-bearer/pkg/config/defaults/defaultconfig.go @@ -42,16 +42,8 @@ func DefaultConfig() *config.Config { // EnsureDefaults adds default values to the configuration if they are not set yet func EnsureDefaults(cfg *config.Config) { - // provide with defaults for shared logging, since we need a valid destination address for "envdecode". - 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" } if cfg.Reva == nil && cfg.Commons != nil { diff --git a/services/auth-bearer/pkg/logging/logging.go b/services/auth-bearer/pkg/logging/logging.go deleted file mode 100644 index ed5c0f02c..000000000 --- a/services/auth-bearer/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/auth-bearer/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), - ) -} From fb5d5b7cc5eeb004027525db2baad8c56526e148 Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Thu, 8 Jan 2026 12:07:01 +0100 Subject: [PATCH 10/45] consolidate log config in auth-machine Signed-off-by: Christian Richter --- services/auth-machine/pkg/command/health.go | 4 ++-- services/auth-machine/pkg/command/server.go | 4 ++-- services/auth-machine/pkg/config/config.go | 15 ++++----------- .../pkg/config/defaults/defaultconfig.go | 13 ++----------- services/auth-machine/pkg/logging/logging.go | 17 ----------------- 5 files changed, 10 insertions(+), 43 deletions(-) delete mode 100644 services/auth-machine/pkg/logging/logging.go diff --git a/services/auth-machine/pkg/command/health.go b/services/auth-machine/pkg/command/health.go index 305162603..09bafd7cd 100644 --- a/services/auth-machine/pkg/command/health.go +++ b/services/auth-machine/pkg/command/health.go @@ -5,9 +5,9 @@ import ( "net/http" "github.com/opencloud-eu/opencloud/pkg/config/configlog" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/services/auth-machine/pkg/config" "github.com/opencloud-eu/opencloud/services/auth-machine/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/auth-machine/pkg/logging" "github.com/spf13/cobra" ) @@ -21,7 +21,7 @@ func Health(cfg *config.Config) *cobra.Command { return configlog.ReturnError(parser.ParseConfig(cfg)) }, 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) resp, err := http.Get( fmt.Sprintf( diff --git a/services/auth-machine/pkg/command/server.go b/services/auth-machine/pkg/command/server.go index 3821939fb..f543ece99 100644 --- a/services/auth-machine/pkg/command/server.go +++ b/services/auth-machine/pkg/command/server.go @@ -6,13 +6,13 @@ import ( "os/signal" "github.com/opencloud-eu/opencloud/pkg/config/configlog" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/pkg/registry" "github.com/opencloud-eu/opencloud/pkg/runner" "github.com/opencloud-eu/opencloud/pkg/tracing" "github.com/opencloud-eu/opencloud/pkg/version" "github.com/opencloud-eu/opencloud/services/auth-machine/pkg/config" "github.com/opencloud-eu/opencloud/services/auth-machine/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/auth-machine/pkg/logging" "github.com/opencloud-eu/opencloud/services/auth-machine/pkg/revaconfig" "github.com/opencloud-eu/opencloud/services/auth-machine/pkg/server/debug" "github.com/opencloud-eu/reva/v2/cmd/revad/runtime" @@ -29,7 +29,7 @@ func Server(cfg *config.Config) *cobra.Command { return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, 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) traceProvider, err := tracing.GetTraceProvider(cmd.Context(), cfg.Commons.TracesExporter, cfg.Service.Name) if err != nil { return err diff --git a/services/auth-machine/pkg/config/config.go b/services/auth-machine/pkg/config/config.go index be007ab26..623dce58d 100644 --- a/services/auth-machine/pkg/config/config.go +++ b/services/auth-machine/pkg/config/config.go @@ -7,10 +7,10 @@ import ( ) type Config struct { - Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service - Service Service `yaml:"-"` - Log *Log `yaml:"log"` - Debug Debug `yaml:"debug"` + Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service + Service Service `yaml:"-"` + LogLevel string `yaml:"level" env:"OC_LOG_LEVEL;AUTH_MACHINE_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + Debug Debug `yaml:"debug"` GRPC GRPCConfig `yaml:"grpc"` @@ -24,13 +24,6 @@ type Config struct { Context context.Context `yaml:"-"` } -type Log struct { - Level string `yaml:"level" env:"OC_LOG_LEVEL;AUTH_MACHINE_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` - Pretty bool `yaml:"pretty" env:"OC_LOG_PRETTY;AUTH_MACHINE_LOG_PRETTY" desc:"Activates pretty log output." introductionVersion:"1.0.0"` - Color bool `yaml:"color" env:"OC_LOG_COLOR;AUTH_MACHINE_LOG_COLOR" desc:"Activates colorized log output." introductionVersion:"1.0.0"` - File string `yaml:"file" env:"OC_LOG_FILE;AUTH_MACHINE_LOG_FILE" desc:"The path to the log file. Activates logging to this file if set." introductionVersion:"1.0.0"` -} - type Service struct { Name string `yaml:"-"` } diff --git a/services/auth-machine/pkg/config/defaults/defaultconfig.go b/services/auth-machine/pkg/config/defaults/defaultconfig.go index 17dcf313f..d27c14fc2 100644 --- a/services/auth-machine/pkg/config/defaults/defaultconfig.go +++ b/services/auth-machine/pkg/config/defaults/defaultconfig.go @@ -37,18 +37,9 @@ func DefaultConfig() *config.Config { // EnsureDefaults adds default values to the configuration if they are not set yet func EnsureDefaults(cfg *config.Config) { - // provide with defaults for shared logging, since we need a valid destination address for "envdecode". - 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" } - if cfg.Reva == nil && cfg.Commons != nil { cfg.Reva = structs.CopyOrZeroValue(cfg.Commons.Reva) } diff --git a/services/auth-machine/pkg/logging/logging.go b/services/auth-machine/pkg/logging/logging.go deleted file mode 100644 index ec297533f..000000000 --- a/services/auth-machine/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/auth-machine/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), - ) -} From a5c8ec5f572c8053e6ba86e70959815f2e1649f0 Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Thu, 8 Jan 2026 12:23:12 +0100 Subject: [PATCH 11/45] consolidate log config in auth-service Signed-off-by: Christian Richter --- services/auth-service/pkg/command/health.go | 4 ++-- services/auth-service/pkg/command/server.go | 4 ++-- services/auth-service/pkg/config/config.go | 15 ++++----------- .../pkg/config/defaults/defaultconfig.go | 12 ++---------- services/auth-service/pkg/logging/logging.go | 17 ----------------- 5 files changed, 10 insertions(+), 42 deletions(-) delete mode 100644 services/auth-service/pkg/logging/logging.go diff --git a/services/auth-service/pkg/command/health.go b/services/auth-service/pkg/command/health.go index d9124a91a..41ef191d5 100644 --- a/services/auth-service/pkg/command/health.go +++ b/services/auth-service/pkg/command/health.go @@ -5,9 +5,9 @@ import ( "net/http" "github.com/opencloud-eu/opencloud/pkg/config/configlog" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/services/auth-service/pkg/config" "github.com/opencloud-eu/opencloud/services/auth-service/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/auth-service/pkg/logging" "github.com/spf13/cobra" ) @@ -21,7 +21,7 @@ func Health(cfg *config.Config) *cobra.Command { return configlog.ReturnError(parser.ParseConfig(cfg)) }, 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) resp, err := http.Get( fmt.Sprintf( diff --git a/services/auth-service/pkg/command/server.go b/services/auth-service/pkg/command/server.go index b6a4aab21..28aca4004 100644 --- a/services/auth-service/pkg/command/server.go +++ b/services/auth-service/pkg/command/server.go @@ -6,13 +6,13 @@ import ( "os/signal" "github.com/opencloud-eu/opencloud/pkg/config/configlog" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/pkg/registry" "github.com/opencloud-eu/opencloud/pkg/runner" "github.com/opencloud-eu/opencloud/pkg/tracing" "github.com/opencloud-eu/opencloud/pkg/version" "github.com/opencloud-eu/opencloud/services/auth-service/pkg/config" "github.com/opencloud-eu/opencloud/services/auth-service/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/auth-service/pkg/logging" "github.com/opencloud-eu/opencloud/services/auth-service/pkg/revaconfig" "github.com/opencloud-eu/opencloud/services/auth-service/pkg/server/debug" "github.com/opencloud-eu/reva/v2/cmd/revad/runtime" @@ -29,7 +29,7 @@ func Server(cfg *config.Config) *cobra.Command { return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, 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) traceProvider, err := tracing.GetTraceProvider(cmd.Context(), cfg.Commons.TracesExporter, cfg.Service.Name) if err != nil { return err diff --git a/services/auth-service/pkg/config/config.go b/services/auth-service/pkg/config/config.go index 231f6bcd3..c60c71064 100644 --- a/services/auth-service/pkg/config/config.go +++ b/services/auth-service/pkg/config/config.go @@ -7,10 +7,10 @@ import ( ) type Config struct { - Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service - Service Service `yaml:"-"` - Log *Log `yaml:"log"` - Debug Debug `yaml:"debug"` + Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service + Service Service `yaml:"-"` + LogLevel string `yaml:"level" env:"OC_LOG_LEVEL;AUTH_SERVICE_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + Debug Debug `yaml:"debug"` GRPC GRPCConfig `yaml:"grpc"` @@ -23,13 +23,6 @@ type Config struct { Context context.Context `yaml:"-"` } -type Log struct { - Level string `yaml:"level" env:"OC_LOG_LEVEL;AUTH_SERVICE_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` - Pretty bool `yaml:"pretty" env:"OC_LOG_PRETTY;AUTH_SERVICE_LOG_PRETTY" desc:"Activates pretty log output." introductionVersion:"1.0.0"` - Color bool `yaml:"color" env:"OC_LOG_COLOR;AUTH_SERVICE_LOG_COLOR" desc:"Activates colorized log output." introductionVersion:"1.0.0"` - File string `yaml:"file" env:"OC_LOG_FILE;AUTH_SERVICE_LOG_FILE" desc:"The path to the log file. Activates logging to this file if set." introductionVersion:"1.0.0"` -} - type Service struct { Name string `yaml:"-"` } diff --git a/services/auth-service/pkg/config/defaults/defaultconfig.go b/services/auth-service/pkg/config/defaults/defaultconfig.go index d1a9f7d08..31cd25f20 100644 --- a/services/auth-service/pkg/config/defaults/defaultconfig.go +++ b/services/auth-service/pkg/config/defaults/defaultconfig.go @@ -37,16 +37,8 @@ func DefaultConfig() *config.Config { // EnsureDefaults adds default values to the configuration if they are not set yet func EnsureDefaults(cfg *config.Config) { - // provide with defaults for shared logging, since we need a valid destination address for "envdecode". - 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" } if cfg.Reva == nil && cfg.Commons != nil { diff --git a/services/auth-service/pkg/logging/logging.go b/services/auth-service/pkg/logging/logging.go deleted file mode 100644 index 8098a5eb7..000000000 --- a/services/auth-service/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/auth-service/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), - ) -} From 8a993126a457d00e21406f092352794e6d62f586 Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Thu, 8 Jan 2026 12:25:22 +0100 Subject: [PATCH 12/45] consolidate log config in clientlog Signed-off-by: Christian Richter --- services/clientlog/pkg/command/server.go | 4 ++-- services/clientlog/pkg/config/config.go | 3 ++- .../pkg/config/defaults/defaultconfig.go | 12 ++---------- services/clientlog/pkg/config/log.go | 9 --------- services/clientlog/pkg/logging/logging.go | 17 ----------------- 5 files changed, 6 insertions(+), 39 deletions(-) delete mode 100644 services/clientlog/pkg/config/log.go delete mode 100644 services/clientlog/pkg/logging/logging.go diff --git a/services/clientlog/pkg/command/server.go b/services/clientlog/pkg/command/server.go index 615625583..9472e072a 100644 --- a/services/clientlog/pkg/command/server.go +++ b/services/clientlog/pkg/command/server.go @@ -7,13 +7,13 @@ import ( "github.com/opencloud-eu/opencloud/pkg/config/configlog" "github.com/opencloud-eu/opencloud/pkg/generators" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/pkg/registry" "github.com/opencloud-eu/opencloud/pkg/runner" "github.com/opencloud-eu/opencloud/pkg/tracing" "github.com/opencloud-eu/opencloud/pkg/version" "github.com/opencloud-eu/opencloud/services/clientlog/pkg/config" "github.com/opencloud-eu/opencloud/services/clientlog/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/clientlog/pkg/logging" "github.com/opencloud-eu/opencloud/services/clientlog/pkg/metrics" "github.com/opencloud-eu/opencloud/services/clientlog/pkg/server/debug" "github.com/opencloud-eu/opencloud/services/clientlog/pkg/service" @@ -55,7 +55,7 @@ func Server(cfg *config.Config) *cobra.Command { return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, 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) tracerProvider, err := tracing.GetTraceProvider(cmd.Context(), cfg.Commons.TracesExporter, cfg.Service.Name) if err != nil { return err diff --git a/services/clientlog/pkg/config/config.go b/services/clientlog/pkg/config/config.go index a55c81bfe..29b5a08a3 100644 --- a/services/clientlog/pkg/config/config.go +++ b/services/clientlog/pkg/config/config.go @@ -12,7 +12,8 @@ type Config struct { Service Service `yaml:"-"` - Log *Log `yaml:"log"` + LogLevel string `mapstructure:"level" env:"OC_LOG_LEVEL;CLIENTLOG_USERLOG_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + Debug Debug `yaml:"debug"` GRPCClientTLS *shared.GRPCClientTLS `yaml:"grpc_client_tls"` diff --git a/services/clientlog/pkg/config/defaults/defaultconfig.go b/services/clientlog/pkg/config/defaults/defaultconfig.go index 5c615e374..82a64072b 100644 --- a/services/clientlog/pkg/config/defaults/defaultconfig.go +++ b/services/clientlog/pkg/config/defaults/defaultconfig.go @@ -37,16 +37,8 @@ func DefaultConfig() *config.Config { // EnsureDefaults ensures the config contains default values func EnsureDefaults(cfg *config.Config) { - // provide with defaults for shared logging, since we need a valid destination address for "envdecode". - 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" } if cfg.GRPCClientTLS == nil && cfg.Commons != nil { diff --git a/services/clientlog/pkg/config/log.go b/services/clientlog/pkg/config/log.go deleted file mode 100644 index 68ce9f748..000000000 --- a/services/clientlog/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;CLIENTLOG_USERLOG_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;CLIENTLOG_USERLOG_LOG_PRETTY" desc:"Activates pretty log output." introductionVersion:"1.0.0"` - Color bool `mapstructure:"color" env:"OC_LOG_COLOR;CLIENTLOG_USERLOG_LOG_COLOR" desc:"Activates colorized log output." introductionVersion:"1.0.0"` - File string `mapstructure:"file" env:"OC_LOG_FILE;CLIENTLOG_USERLOG_LOG_FILE" desc:"The path to the log file. Activates logging to this file if set." introductionVersion:"1.0.0"` -} diff --git a/services/clientlog/pkg/logging/logging.go b/services/clientlog/pkg/logging/logging.go deleted file mode 100644 index b8d64c41a..000000000 --- a/services/clientlog/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/clientlog/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), - ) -} From e41f6c34b6c35468b61ef516d8014ea0a55dd2e3 Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Thu, 8 Jan 2026 12:42:15 +0100 Subject: [PATCH 13/45] consolidate log config in collaboration Signed-off-by: Christian Richter --- services/collaboration/pkg/command/health.go | 4 ++-- services/collaboration/pkg/command/server.go | 4 ++-- services/collaboration/pkg/config/config.go | 4 ++-- .../pkg/config/defaults/defaultconfig.go | 12 ++---------- services/collaboration/pkg/config/log.go | 9 --------- services/collaboration/pkg/logging/logging.go | 17 ----------------- 6 files changed, 8 insertions(+), 42 deletions(-) delete mode 100644 services/collaboration/pkg/config/log.go delete mode 100644 services/collaboration/pkg/logging/logging.go diff --git a/services/collaboration/pkg/command/health.go b/services/collaboration/pkg/command/health.go index 35e8414d4..d4ffcef51 100644 --- a/services/collaboration/pkg/command/health.go +++ b/services/collaboration/pkg/command/health.go @@ -5,9 +5,9 @@ import ( "net/http" "github.com/opencloud-eu/opencloud/pkg/config/configlog" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/services/collaboration/pkg/config" "github.com/opencloud-eu/opencloud/services/collaboration/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/collaboration/pkg/logging" "github.com/spf13/cobra" ) @@ -21,7 +21,7 @@ func Health(cfg *config.Config) *cobra.Command { return configlog.ReturnError(parser.ParseConfig(cfg)) }, 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) resp, err := http.Get( fmt.Sprintf( diff --git a/services/collaboration/pkg/command/server.go b/services/collaboration/pkg/command/server.go index ea47dabe3..92e14c097 100644 --- a/services/collaboration/pkg/command/server.go +++ b/services/collaboration/pkg/command/server.go @@ -8,6 +8,7 @@ import ( "time" "github.com/opencloud-eu/opencloud/pkg/config/configlog" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/pkg/registry" "github.com/opencloud-eu/opencloud/pkg/runner" "github.com/opencloud-eu/opencloud/pkg/tracing" @@ -15,7 +16,6 @@ import ( "github.com/opencloud-eu/opencloud/services/collaboration/pkg/config/parser" "github.com/opencloud-eu/opencloud/services/collaboration/pkg/connector" "github.com/opencloud-eu/opencloud/services/collaboration/pkg/helpers" - "github.com/opencloud-eu/opencloud/services/collaboration/pkg/logging" "github.com/opencloud-eu/opencloud/services/collaboration/pkg/server/debug" "github.com/opencloud-eu/opencloud/services/collaboration/pkg/server/grpc" "github.com/opencloud-eu/opencloud/services/collaboration/pkg/server/http" @@ -35,7 +35,7 @@ func Server(cfg *config.Config) *cobra.Command { return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, 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) traceProvider, err := tracing.GetTraceProvider(cmd.Context(), cfg.Commons.TracesExporter, cfg.Service.Name) if err != nil { return err diff --git a/services/collaboration/pkg/config/config.go b/services/collaboration/pkg/config/config.go index bdf62a8c4..93a1c5959 100644 --- a/services/collaboration/pkg/config/config.go +++ b/services/collaboration/pkg/config/config.go @@ -22,8 +22,8 @@ type Config struct { Wopi Wopi `yaml:"wopi"` CS3Api CS3Api `yaml:"cs3api"` - Log *Log `yaml:"log"` - Debug Debug `yaml:"debug"` + LogLevel string `yaml:"level" env:"OC_LOG_LEVEL;COLLABORATION_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + Debug Debug `yaml:"debug"` Context context.Context `yaml:"-"` } diff --git a/services/collaboration/pkg/config/defaults/defaultconfig.go b/services/collaboration/pkg/config/defaults/defaultconfig.go index c8119dab3..20aaf45b8 100644 --- a/services/collaboration/pkg/config/defaults/defaultconfig.go +++ b/services/collaboration/pkg/config/defaults/defaultconfig.go @@ -72,16 +72,8 @@ func DefaultConfig() *config.Config { // EnsureDefaults adds default values to the configuration if they are not set yet func EnsureDefaults(cfg *config.Config) { - // provide with defaults for shared logging, since we need a valid destination address for "envdecode". - 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" } if cfg.TokenManager == nil && cfg.Commons != nil && cfg.Commons.TokenManager != nil { diff --git a/services/collaboration/pkg/config/log.go b/services/collaboration/pkg/config/log.go deleted file mode 100644 index 391e6fa1e..000000000 --- a/services/collaboration/pkg/config/log.go +++ /dev/null @@ -1,9 +0,0 @@ -package config - -// Log defines the available log configuration. -type Log struct { - Level string `yaml:"level" env:"OC_LOG_LEVEL;COLLABORATION_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` - Pretty bool `yaml:"pretty" env:"OC_LOG_PRETTY;COLLABORATION_LOG_PRETTY" desc:"Activates pretty log output." introductionVersion:"1.0.0"` - Color bool `yaml:"color" env:"OC_LOG_COLOR;COLLABORATION_LOG_COLOR" desc:"Activates colorized log output." introductionVersion:"1.0.0"` - File string `yaml:"file" env:"OC_LOG_FILE;COLLABORATION_LOG_FILE" desc:"The path to the log file. Activates logging to this file if set." introductionVersion:"1.0.0"` -} diff --git a/services/collaboration/pkg/logging/logging.go b/services/collaboration/pkg/logging/logging.go deleted file mode 100644 index 0048065e1..000000000 --- a/services/collaboration/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/collaboration/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), - ) -} From 8541da37f6fe1f737197f24fe1da4aa2aa90876b Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Thu, 8 Jan 2026 12:44:17 +0100 Subject: [PATCH 14/45] consolidate log config in eventhistory Signed-off-by: Christian Richter --- services/eventhistory/pkg/command/server.go | 4 ++-- services/eventhistory/pkg/config/config.go | 4 ++-- .../pkg/config/defaults/defaultconfig.go | 12 ++---------- services/eventhistory/pkg/config/log.go | 9 --------- services/eventhistory/pkg/logging/logging.go | 17 ----------------- 5 files changed, 6 insertions(+), 40 deletions(-) delete mode 100644 services/eventhistory/pkg/config/log.go delete mode 100644 services/eventhistory/pkg/logging/logging.go diff --git a/services/eventhistory/pkg/command/server.go b/services/eventhistory/pkg/command/server.go index 94cdfc927..d3612fc25 100644 --- a/services/eventhistory/pkg/command/server.go +++ b/services/eventhistory/pkg/command/server.go @@ -7,13 +7,13 @@ import ( "github.com/opencloud-eu/opencloud/pkg/config/configlog" "github.com/opencloud-eu/opencloud/pkg/generators" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/pkg/runner" ogrpc "github.com/opencloud-eu/opencloud/pkg/service/grpc" "github.com/opencloud-eu/opencloud/pkg/tracing" "github.com/opencloud-eu/opencloud/pkg/version" "github.com/opencloud-eu/opencloud/services/eventhistory/pkg/config" "github.com/opencloud-eu/opencloud/services/eventhistory/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/eventhistory/pkg/logging" "github.com/opencloud-eu/opencloud/services/eventhistory/pkg/metrics" "github.com/opencloud-eu/opencloud/services/eventhistory/pkg/server/debug" "github.com/opencloud-eu/opencloud/services/eventhistory/pkg/server/grpc" @@ -33,7 +33,7 @@ func Server(cfg *config.Config) *cobra.Command { return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, 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) traceProvider, err := tracing.GetTraceProvider(cmd.Context(), cfg.Commons.TracesExporter, cfg.Service.Name) if err != nil { return err diff --git a/services/eventhistory/pkg/config/config.go b/services/eventhistory/pkg/config/config.go index 18a69b3ac..9512aa007 100644 --- a/services/eventhistory/pkg/config/config.go +++ b/services/eventhistory/pkg/config/config.go @@ -14,8 +14,8 @@ type Config struct { Service Service `yaml:"-"` - Log *Log `yaml:"log"` - Debug Debug `yaml:"debug"` + LogLevel string `mapstructure:"level" env:"OC_LOG_LEVEL;EVENTHISTORY_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + Debug Debug `yaml:"debug"` GRPC GRPCConfig `yaml:"grpc"` GRPCClientTLS *shared.GRPCClientTLS `yaml:"grpc_client_tls"` diff --git a/services/eventhistory/pkg/config/defaults/defaultconfig.go b/services/eventhistory/pkg/config/defaults/defaultconfig.go index f8180be7d..ee085414d 100644 --- a/services/eventhistory/pkg/config/defaults/defaultconfig.go +++ b/services/eventhistory/pkg/config/defaults/defaultconfig.go @@ -48,16 +48,8 @@ func DefaultConfig() *config.Config { // EnsureDefaults ensures the config contains default values func EnsureDefaults(cfg *config.Config) { - // provide with defaults for shared logging, since we need a valid destination address for "envdecode". - 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" } if cfg.GRPCClientTLS == nil && cfg.Commons != nil { diff --git a/services/eventhistory/pkg/config/log.go b/services/eventhistory/pkg/config/log.go deleted file mode 100644 index 3293bea1a..000000000 --- a/services/eventhistory/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;EVENTHISTORY_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;EVENTHISTORY_LOG_PRETTY" desc:"Activates pretty log output." introductionVersion:"1.0.0"` - Color bool `mapstructure:"color" env:"OC_LOG_COLOR;EVENTHISTORY_LOG_COLOR" desc:"Activates colorized log output." introductionVersion:"1.0.0"` - File string `mapstructure:"file" env:"OC_LOG_FILE;EVENTHISTORY_LOG_FILE" desc:"The path to the log file. Activates logging to this file if set." introductionVersion:"1.0.0"` -} diff --git a/services/eventhistory/pkg/logging/logging.go b/services/eventhistory/pkg/logging/logging.go deleted file mode 100644 index ce531795e..000000000 --- a/services/eventhistory/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/eventhistory/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), - ) -} From 1c9ec51c5d3f26a41fb1a0d888d0458b601ab7df Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Thu, 8 Jan 2026 12:46:25 +0100 Subject: [PATCH 15/45] consolidate log config in frontend Signed-off-by: Christian Richter --- services/frontend/pkg/command/health.go | 4 ++-- services/frontend/pkg/command/server.go | 4 ++-- services/frontend/pkg/config/config.go | 15 ++++----------- .../pkg/config/defaults/defaultconfig.go | 12 ++---------- services/frontend/pkg/logging/logging.go | 17 ----------------- 5 files changed, 10 insertions(+), 42 deletions(-) delete mode 100644 services/frontend/pkg/logging/logging.go diff --git a/services/frontend/pkg/command/health.go b/services/frontend/pkg/command/health.go index 43ddd2a93..efe0e9693 100644 --- a/services/frontend/pkg/command/health.go +++ b/services/frontend/pkg/command/health.go @@ -6,9 +6,9 @@ import ( "net/http" "github.com/opencloud-eu/opencloud/pkg/config/configlog" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/services/frontend/pkg/config" "github.com/opencloud-eu/opencloud/services/frontend/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/frontend/pkg/logging" "github.com/spf13/cobra" ) @@ -22,7 +22,7 @@ func Health(cfg *config.Config) *cobra.Command { return configlog.ReturnError(parser.ParseConfig(cfg)) }, 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) resp, err := http.Get( fmt.Sprintf( diff --git a/services/frontend/pkg/command/server.go b/services/frontend/pkg/command/server.go index 547c7c8b2..17da6ff7a 100644 --- a/services/frontend/pkg/command/server.go +++ b/services/frontend/pkg/command/server.go @@ -6,13 +6,13 @@ import ( "os/signal" "github.com/opencloud-eu/opencloud/pkg/config/configlog" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/pkg/registry" "github.com/opencloud-eu/opencloud/pkg/runner" "github.com/opencloud-eu/opencloud/pkg/tracing" "github.com/opencloud-eu/opencloud/pkg/version" "github.com/opencloud-eu/opencloud/services/frontend/pkg/config" "github.com/opencloud-eu/opencloud/services/frontend/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/frontend/pkg/logging" "github.com/opencloud-eu/opencloud/services/frontend/pkg/revaconfig" "github.com/opencloud-eu/opencloud/services/frontend/pkg/server/debug" "github.com/opencloud-eu/reva/v2/cmd/revad/runtime" @@ -29,7 +29,7 @@ func Server(cfg *config.Config) *cobra.Command { return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, 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) traceProvider, err := tracing.GetTraceProvider(cmd.Context(), cfg.Commons.TracesExporter, cfg.Service.Name) if err != nil { return err diff --git a/services/frontend/pkg/config/config.go b/services/frontend/pkg/config/config.go index ece3152f8..1b1b4cb49 100644 --- a/services/frontend/pkg/config/config.go +++ b/services/frontend/pkg/config/config.go @@ -8,10 +8,10 @@ import ( ) type Config struct { - Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service - Service Service `yaml:"-"` - Log *Log `yaml:"log"` - Debug Debug `yaml:"debug"` + Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service + Service Service `yaml:"-"` + LogLevel string `yaml:"level" env:"OC_LOG_LEVEL;FRONTEND_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + Debug Debug `yaml:"debug"` HTTP HTTPConfig `yaml:"http"` @@ -67,13 +67,6 @@ type Config struct { Context context.Context `yaml:"-"` } -type Log struct { - Level string `yaml:"level" env:"OC_LOG_LEVEL;FRONTEND_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` - Pretty bool `yaml:"pretty" env:"OC_LOG_PRETTY;FRONTEND_LOG_PRETTY" desc:"Activates pretty log output." introductionVersion:"1.0.0"` - Color bool `yaml:"color" env:"OC_LOG_COLOR;FRONTEND_LOG_COLOR" desc:"Activates colorized log output." introductionVersion:"1.0.0"` - File string `yaml:"file" env:"OC_LOG_FILE;FRONTEND_LOG_FILE" desc:"The path to the log file. Activates logging to this file if set." introductionVersion:"1.0.0"` -} - type Service struct { Name string `yaml:"-"` } diff --git a/services/frontend/pkg/config/defaults/defaultconfig.go b/services/frontend/pkg/config/defaults/defaultconfig.go index 5faef3bc2..fb2a958d5 100644 --- a/services/frontend/pkg/config/defaults/defaultconfig.go +++ b/services/frontend/pkg/config/defaults/defaultconfig.go @@ -164,16 +164,8 @@ func DefaultConfig() *config.Config { // EnsureDefaults adds default values to the configuration if they are not set yet func EnsureDefaults(cfg *config.Config) { - // provide with defaults for shared logging, since we need a valid destination address for "envdecode". - 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" } if cfg.Reva == nil && cfg.Commons != nil { diff --git a/services/frontend/pkg/logging/logging.go b/services/frontend/pkg/logging/logging.go deleted file mode 100644 index dbd4c7baf..000000000 --- a/services/frontend/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/frontend/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), - ) -} From b13e65d4864642be95c866e8197fcd42e045f342 Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Thu, 8 Jan 2026 12:48:26 +0100 Subject: [PATCH 16/45] consolidate log config in gateway Signed-off-by: Christian Richter --- services/gateway/pkg/command/health.go | 4 ++-- services/gateway/pkg/command/server.go | 4 ++-- services/gateway/pkg/config/config.go | 13 +++---------- .../pkg/config/defaults/defaultconfig.go | 12 ++---------- services/gateway/pkg/logging/logging.go | 17 ----------------- 5 files changed, 9 insertions(+), 41 deletions(-) delete mode 100644 services/gateway/pkg/logging/logging.go diff --git a/services/gateway/pkg/command/health.go b/services/gateway/pkg/command/health.go index 83b35d2ee..39c7245f7 100644 --- a/services/gateway/pkg/command/health.go +++ b/services/gateway/pkg/command/health.go @@ -5,9 +5,9 @@ import ( "net/http" "github.com/opencloud-eu/opencloud/pkg/config/configlog" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/services/gateway/pkg/config" "github.com/opencloud-eu/opencloud/services/gateway/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/gateway/pkg/logging" "github.com/spf13/cobra" ) @@ -21,7 +21,7 @@ func Health(cfg *config.Config) *cobra.Command { return configlog.ReturnError(parser.ParseConfig(cfg)) }, 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) resp, err := http.Get( fmt.Sprintf( diff --git a/services/gateway/pkg/command/server.go b/services/gateway/pkg/command/server.go index 038f88129..e198f8522 100644 --- a/services/gateway/pkg/command/server.go +++ b/services/gateway/pkg/command/server.go @@ -6,13 +6,13 @@ import ( "os/signal" "github.com/opencloud-eu/opencloud/pkg/config/configlog" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/pkg/registry" "github.com/opencloud-eu/opencloud/pkg/runner" "github.com/opencloud-eu/opencloud/pkg/tracing" "github.com/opencloud-eu/opencloud/pkg/version" "github.com/opencloud-eu/opencloud/services/gateway/pkg/config" "github.com/opencloud-eu/opencloud/services/gateway/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/gateway/pkg/logging" "github.com/opencloud-eu/opencloud/services/gateway/pkg/revaconfig" "github.com/opencloud-eu/opencloud/services/gateway/pkg/server/debug" "github.com/opencloud-eu/reva/v2/cmd/revad/runtime" @@ -29,7 +29,7 @@ func Server(cfg *config.Config) *cobra.Command { return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, 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) traceProvider, err := tracing.GetTraceProvider(cmd.Context(), cfg.Commons.TracesExporter, cfg.Service.Name) if err != nil { return err diff --git a/services/gateway/pkg/config/config.go b/services/gateway/pkg/config/config.go index 4f6a50f15..810fb4d84 100644 --- a/services/gateway/pkg/config/config.go +++ b/services/gateway/pkg/config/config.go @@ -10,9 +10,9 @@ import ( type Config struct { Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service - Service Service `yaml:"-"` - Log *Log `yaml:"log"` - Debug Debug `yaml:"debug"` + Service Service `yaml:"-"` + LogLevel string `yaml:"level" env:"OC_LOG_LEVEL;GATEWAY_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + Debug Debug `yaml:"debug"` GRPC GRPCConfig `yaml:"grpc"` @@ -50,13 +50,6 @@ type Config struct { Context context.Context `yaml:"-"` } -type Log struct { - Level string `yaml:"level" env:"OC_LOG_LEVEL;GATEWAY_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` - Pretty bool `yaml:"pretty" env:"OC_LOG_PRETTY;GATEWAY_LOG_PRETTY" desc:"Activates pretty log output." introductionVersion:"1.0.0"` - Color bool `yaml:"color" env:"OC_LOG_COLOR;GATEWAY_LOG_COLOR" desc:"Activates colorized log output." introductionVersion:"1.0.0"` - File string `yaml:"file" env:"OC_LOG_FILE;GATEWAY_LOG_FILE" desc:"The path to the log file. Activates logging to this file if set." introductionVersion:"1.0.0"` -} - type Service struct { Name string `yaml:"-"` } diff --git a/services/gateway/pkg/config/defaults/defaultconfig.go b/services/gateway/pkg/config/defaults/defaultconfig.go index c0fc84428..bbe5ddda5 100644 --- a/services/gateway/pkg/config/defaults/defaultconfig.go +++ b/services/gateway/pkg/config/defaults/defaultconfig.go @@ -74,16 +74,8 @@ func DefaultConfig() *config.Config { // EnsureDefaults adds default values to the configuration if they are not set yet func EnsureDefaults(cfg *config.Config) { - // provide with defaults for shared logging, since we need a valid destination address for "envdecode". - 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" } if cfg.Reva == nil && cfg.Commons != nil { diff --git a/services/gateway/pkg/logging/logging.go b/services/gateway/pkg/logging/logging.go deleted file mode 100644 index 8095315eb..000000000 --- a/services/gateway/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/gateway/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), - ) -} From 95f0c06ad14cb710a09b22a87711fb9bd0a0b224 Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Thu, 8 Jan 2026 12:50:30 +0100 Subject: [PATCH 17/45] consolidate log config in graph Signed-off-by: Christian Richter --- services/graph/pkg/command/health.go | 4 ++-- services/graph/pkg/command/server.go | 4 ++-- services/graph/pkg/config/config.go | 6 +++--- .../graph/pkg/config/defaults/defaultconfig.go | 12 ++---------- services/graph/pkg/config/log.go | 9 --------- services/graph/pkg/logging/logging.go | 17 ----------------- 6 files changed, 9 insertions(+), 43 deletions(-) delete mode 100644 services/graph/pkg/config/log.go delete mode 100644 services/graph/pkg/logging/logging.go diff --git a/services/graph/pkg/command/health.go b/services/graph/pkg/command/health.go index cac63221b..9b4ed9fe3 100644 --- a/services/graph/pkg/command/health.go +++ b/services/graph/pkg/command/health.go @@ -5,9 +5,9 @@ import ( "net/http" "github.com/opencloud-eu/opencloud/pkg/config/configlog" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/services/graph/pkg/config" "github.com/opencloud-eu/opencloud/services/graph/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/graph/pkg/logging" "github.com/spf13/cobra" ) @@ -21,7 +21,7 @@ func Health(cfg *config.Config) *cobra.Command { return configlog.ReturnError(parser.ParseConfig(cfg)) }, 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) resp, err := http.Get( fmt.Sprintf( diff --git a/services/graph/pkg/command/server.go b/services/graph/pkg/command/server.go index fb61fadd7..5d4dadbe1 100644 --- a/services/graph/pkg/command/server.go +++ b/services/graph/pkg/command/server.go @@ -6,12 +6,12 @@ import ( "os/signal" "github.com/opencloud-eu/opencloud/pkg/config/configlog" + "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/pkg/version" "github.com/opencloud-eu/opencloud/services/graph/pkg/config" "github.com/opencloud-eu/opencloud/services/graph/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/graph/pkg/logging" "github.com/opencloud-eu/opencloud/services/graph/pkg/metrics" "github.com/opencloud-eu/opencloud/services/graph/pkg/server/debug" "github.com/opencloud-eu/opencloud/services/graph/pkg/server/http" @@ -31,7 +31,7 @@ func Server(cfg *config.Config) *cobra.Command { return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, 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) traceProvider, err := tracing.GetTraceProvider(cmd.Context(), cfg.Commons.TracesExporter, cfg.Service.Name) if err != nil { return err diff --git a/services/graph/pkg/config/config.go b/services/graph/pkg/config/config.go index 6386025a8..a446883a0 100644 --- a/services/graph/pkg/config/config.go +++ b/services/graph/pkg/config/config.go @@ -13,9 +13,9 @@ type Config struct { Service Service `yaml:"-"` - Log *Log `yaml:"log"` - Cache *Cache `yaml:"cache"` - Debug Debug `yaml:"debug"` + LogLevel string `mapstructure:"level" env:"OC_LOG_LEVEL;GRAPH_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + Cache *Cache `yaml:"cache"` + Debug Debug `yaml:"debug"` HTTP HTTP `yaml:"http"` diff --git a/services/graph/pkg/config/defaults/defaultconfig.go b/services/graph/pkg/config/defaults/defaultconfig.go index 0a97411a8..9b5352f6e 100644 --- a/services/graph/pkg/config/defaults/defaultconfig.go +++ b/services/graph/pkg/config/defaults/defaultconfig.go @@ -140,16 +140,8 @@ func DefaultConfig() *config.Config { // EnsureDefaults adds default values to the configuration if they are not set yet func EnsureDefaults(cfg *config.Config) { - // provide with defaults for shared logging, since we need a valid destination address for "envdecode". - 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" } if cfg.Cache == nil && cfg.Commons != nil && cfg.Commons.Cache != nil { diff --git a/services/graph/pkg/config/log.go b/services/graph/pkg/config/log.go deleted file mode 100644 index fa1624c4a..000000000 --- a/services/graph/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;GRAPH_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;GRAPH_LOG_PRETTY" desc:"Activates pretty log output." introductionVersion:"1.0.0"` - Color bool `mapstructure:"color" env:"OC_LOG_COLOR;GRAPH_LOG_COLOR" desc:"Activates colorized log output." introductionVersion:"1.0.0"` - File string `mapstructure:"file" env:"OC_LOG_FILE;GRAPH_LOG_FILE" desc:"The path to the log file. Activates logging to this file if set." introductionVersion:"1.0.0"` -} diff --git a/services/graph/pkg/logging/logging.go b/services/graph/pkg/logging/logging.go deleted file mode 100644 index f957e44c6..000000000 --- a/services/graph/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/graph/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), - ) -} From 8fe94446dc8703ffd33f011d1df1c9472c22d62a Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Thu, 8 Jan 2026 12:53:18 +0100 Subject: [PATCH 18/45] consolidate log config in groups Signed-off-by: Christian Richter --- services/groups/pkg/command/health.go | 4 ++-- services/groups/pkg/command/server.go | 4 ++-- services/groups/pkg/config/config.go | 15 ++++----------- .../groups/pkg/config/defaults/defaultconfig.go | 12 ++---------- services/groups/pkg/logging/logging.go | 17 ----------------- 5 files changed, 10 insertions(+), 42 deletions(-) delete mode 100644 services/groups/pkg/logging/logging.go diff --git a/services/groups/pkg/command/health.go b/services/groups/pkg/command/health.go index 250309c20..60eb7fd8b 100644 --- a/services/groups/pkg/command/health.go +++ b/services/groups/pkg/command/health.go @@ -5,9 +5,9 @@ import ( "net/http" "github.com/opencloud-eu/opencloud/pkg/config/configlog" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/services/groups/pkg/config" "github.com/opencloud-eu/opencloud/services/groups/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/groups/pkg/logging" "github.com/spf13/cobra" ) @@ -21,7 +21,7 @@ func Health(cfg *config.Config) *cobra.Command { return configlog.ReturnError(parser.ParseConfig(cfg)) }, 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) resp, err := http.Get( fmt.Sprintf( diff --git a/services/groups/pkg/command/server.go b/services/groups/pkg/command/server.go index 053f3d5a9..efbbd03c0 100644 --- a/services/groups/pkg/command/server.go +++ b/services/groups/pkg/command/server.go @@ -7,13 +7,13 @@ import ( "github.com/opencloud-eu/opencloud/pkg/config/configlog" "github.com/opencloud-eu/opencloud/pkg/ldap" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/pkg/registry" "github.com/opencloud-eu/opencloud/pkg/runner" "github.com/opencloud-eu/opencloud/pkg/tracing" "github.com/opencloud-eu/opencloud/pkg/version" "github.com/opencloud-eu/opencloud/services/groups/pkg/config" "github.com/opencloud-eu/opencloud/services/groups/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/groups/pkg/logging" "github.com/opencloud-eu/opencloud/services/groups/pkg/revaconfig" "github.com/opencloud-eu/opencloud/services/groups/pkg/server/debug" "github.com/opencloud-eu/reva/v2/cmd/revad/runtime" @@ -30,7 +30,7 @@ func Server(cfg *config.Config) *cobra.Command { return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, 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) traceProvider, err := tracing.GetTraceProvider(cmd.Context(), cfg.Commons.TracesExporter, cfg.Service.Name) if err != nil { return err diff --git a/services/groups/pkg/config/config.go b/services/groups/pkg/config/config.go index ae7f59b75..dc1738fd5 100644 --- a/services/groups/pkg/config/config.go +++ b/services/groups/pkg/config/config.go @@ -7,10 +7,10 @@ import ( ) type Config struct { - Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service - Service Service `yaml:"-"` - Log *Log `yaml:"log"` - Debug Debug `yaml:"debug"` + Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service + Service Service `yaml:"-"` + LogLevel string `yaml:"level" env:"OC_LOG_LEVEL;GROUPS_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + Debug Debug `yaml:"debug"` GRPC GRPCConfig `yaml:"grpc"` @@ -25,13 +25,6 @@ type Config struct { Context context.Context `yaml:"-"` } -type Log struct { - Level string `yaml:"level" env:"OC_LOG_LEVEL;GROUPS_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` - Pretty bool `yaml:"pretty" env:"OC_LOG_PRETTY;GROUPS_LOG_PRETTY" desc:"Activates pretty log output." introductionVersion:"1.0.0"` - Color bool `yaml:"color" env:"OC_LOG_COLOR;GROUPS_LOG_COLOR" desc:"Activates colorized log output." introductionVersion:"1.0.0"` - File string `yaml:"file" env:"OC_LOG_FILE;GROUPS_LOG_FILE" desc:"The path to the log file. Activates logging to this file if set." introductionVersion:"1.0.0"` -} - type Service struct { Name string `yaml:"-"` } diff --git a/services/groups/pkg/config/defaults/defaultconfig.go b/services/groups/pkg/config/defaults/defaultconfig.go index 568addf4c..f72307948 100644 --- a/services/groups/pkg/config/defaults/defaultconfig.go +++ b/services/groups/pkg/config/defaults/defaultconfig.go @@ -84,16 +84,8 @@ func DefaultConfig() *config.Config { // EnsureDefaults adds default values to the configuration if they are not set yet func EnsureDefaults(cfg *config.Config) { - // provide with defaults for shared logging, since we need a valid destination address for "envdecode". - 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" } if cfg.Reva == nil && cfg.Commons != nil { diff --git a/services/groups/pkg/logging/logging.go b/services/groups/pkg/logging/logging.go deleted file mode 100644 index aec0df993..000000000 --- a/services/groups/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/groups/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), - ) -} From b9124df8f50d3c52aaed30b85b6956c5e001f356 Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Thu, 8 Jan 2026 12:56:00 +0100 Subject: [PATCH 19/45] consolidate log config in idm Signed-off-by: Christian Richter --- services/idm/pkg/command/health.go | 4 ++-- services/idm/pkg/command/resetpw.go | 3 +-- services/idm/pkg/command/server.go | 3 +-- services/idm/pkg/config/config.go | 4 ++-- .../idm/pkg/config/defaults/defaultconfig.go | 12 ++---------- services/idm/pkg/config/log.go | 9 --------- services/idm/pkg/logging/logging.go | 17 ----------------- 7 files changed, 8 insertions(+), 44 deletions(-) delete mode 100644 services/idm/pkg/config/log.go delete mode 100644 services/idm/pkg/logging/logging.go diff --git a/services/idm/pkg/command/health.go b/services/idm/pkg/command/health.go index 050dd35e2..31d0ab6a4 100644 --- a/services/idm/pkg/command/health.go +++ b/services/idm/pkg/command/health.go @@ -5,9 +5,9 @@ import ( "net/http" "github.com/opencloud-eu/opencloud/pkg/config/configlog" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/services/idm/pkg/config" "github.com/opencloud-eu/opencloud/services/idm/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/idm/pkg/logging" "github.com/spf13/cobra" ) @@ -21,7 +21,7 @@ func Health(cfg *config.Config) *cobra.Command { return configlog.ReturnError(parser.ParseConfig(cfg)) }, 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) resp, err := http.Get( fmt.Sprintf( diff --git a/services/idm/pkg/command/resetpw.go b/services/idm/pkg/command/resetpw.go index 1f31065cd..b172c403b 100644 --- a/services/idm/pkg/command/resetpw.go +++ b/services/idm/pkg/command/resetpw.go @@ -12,7 +12,6 @@ import ( "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/services/idm/pkg/config" "github.com/opencloud-eu/opencloud/services/idm/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/idm/pkg/logging" "github.com/go-ldap/ldap/v3" "github.com/libregraph/idm/pkg/ldbbolt" @@ -31,7 +30,7 @@ func ResetPassword(cfg *config.Config) *cobra.Command { return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, 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) ctx, cancel := context.WithCancel(cmd.Context()) defer cancel() diff --git a/services/idm/pkg/command/server.go b/services/idm/pkg/command/server.go index a71991563..1d2ddbf09 100644 --- a/services/idm/pkg/command/server.go +++ b/services/idm/pkg/command/server.go @@ -17,7 +17,6 @@ import ( "github.com/opencloud-eu/opencloud/services/idm" "github.com/opencloud-eu/opencloud/services/idm/pkg/config" "github.com/opencloud-eu/opencloud/services/idm/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/idm/pkg/logging" "github.com/opencloud-eu/opencloud/services/idm/pkg/server/debug" "github.com/go-ldap/ldif" @@ -43,7 +42,7 @@ func Server(cfg *config.Config) *cobra.Command { } ctx := cfg.Context - logger := logging.Configure(cfg.Service.Name, cfg.Log) + logger := log.Configure(cfg.Service.Name, cfg.Commons, cfg.LogLevel) gr := runner.NewGroup() { diff --git a/services/idm/pkg/config/config.go b/services/idm/pkg/config/config.go index 173c6f480..6dd543835 100644 --- a/services/idm/pkg/config/config.go +++ b/services/idm/pkg/config/config.go @@ -12,8 +12,8 @@ type Config struct { Service Service `yaml:"-"` - Log *Log `yaml:"log"` - Debug Debug `yaml:"debug"` + LogLevel string `mapstructure:"level" env:"OC_LOG_LEVEL;IDM_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + Debug Debug `yaml:"debug"` IDM Settings `yaml:"idm"` CreateDemoUsers bool `yaml:"create_demo_users" env:"IDM_CREATE_DEMO_USERS" desc:"Flag to enable or disable the creation of the demo users." introductionVersion:"1.0.0"` diff --git a/services/idm/pkg/config/defaults/defaultconfig.go b/services/idm/pkg/config/defaults/defaultconfig.go index 0bf7b8afb..225cd9357 100644 --- a/services/idm/pkg/config/defaults/defaultconfig.go +++ b/services/idm/pkg/config/defaults/defaultconfig.go @@ -40,16 +40,8 @@ func DefaultConfig() *config.Config { // EnsureDefaults adds default values to the configuration if they are not set yet func EnsureDefaults(cfg *config.Config) { - // provide with defaults for shared logging, since we need a valid destination address for "envdecode". - 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" } if cfg.AdminUserID == "" && cfg.Commons != nil { diff --git a/services/idm/pkg/config/log.go b/services/idm/pkg/config/log.go deleted file mode 100644 index ebcd31aa5..000000000 --- a/services/idm/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;IDM_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;IDM_LOG_PRETTY" desc:"Activates pretty log output." introductionVersion:"1.0.0"` - Color bool `mapstructure:"color" env:"OC_LOG_COLOR;IDM_LOG_COLOR" desc:"Activates colorized log output." introductionVersion:"1.0.0"` - File string `mapstructure:"file" env:"OC_LOG_FILE;IDM_LOG_FILE" desc:"The path to the log file. Activates logging to this file if set." introductionVersion:"1.0.0"` -} diff --git a/services/idm/pkg/logging/logging.go b/services/idm/pkg/logging/logging.go deleted file mode 100644 index e989ed807..000000000 --- a/services/idm/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/idm/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), - ) -} From 7f5a4427508d05a29f54cf9eceb5557ba15b0166 Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Thu, 8 Jan 2026 12:58:03 +0100 Subject: [PATCH 20/45] consolidate log config in idp Signed-off-by: Christian Richter --- services/idp/pkg/command/health.go | 4 ++-- services/idp/pkg/command/server.go | 4 ++-- services/idp/pkg/config/config.go | 4 ++-- .../idp/pkg/config/defaults/defaultconfig.go | 12 ++---------- services/idp/pkg/config/log.go | 9 --------- services/idp/pkg/logging/logging.go | 17 ----------------- 6 files changed, 8 insertions(+), 42 deletions(-) delete mode 100644 services/idp/pkg/config/log.go delete mode 100644 services/idp/pkg/logging/logging.go diff --git a/services/idp/pkg/command/health.go b/services/idp/pkg/command/health.go index 2cb1f6f49..ff189359a 100644 --- a/services/idp/pkg/command/health.go +++ b/services/idp/pkg/command/health.go @@ -5,9 +5,9 @@ import ( "net/http" "github.com/opencloud-eu/opencloud/pkg/config/configlog" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/services/idp/pkg/config" "github.com/opencloud-eu/opencloud/services/idp/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/idp/pkg/logging" "github.com/spf13/cobra" ) @@ -21,7 +21,7 @@ func Health(cfg *config.Config) *cobra.Command { return configlog.ReturnError(parser.ParseConfig(cfg)) }, 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) resp, err := http.Get( fmt.Sprintf( diff --git a/services/idp/pkg/command/server.go b/services/idp/pkg/command/server.go index 6cc97b8e2..fa08d9eae 100644 --- a/services/idp/pkg/command/server.go +++ b/services/idp/pkg/command/server.go @@ -16,12 +16,12 @@ import ( "path/filepath" "github.com/opencloud-eu/opencloud/pkg/config/configlog" + "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/pkg/version" "github.com/opencloud-eu/opencloud/services/idp/pkg/config" "github.com/opencloud-eu/opencloud/services/idp/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/idp/pkg/logging" "github.com/opencloud-eu/opencloud/services/idp/pkg/metrics" "github.com/opencloud-eu/opencloud/services/idp/pkg/server/debug" "github.com/opencloud-eu/opencloud/services/idp/pkg/server/http" @@ -53,7 +53,7 @@ func Server(cfg *config.Config) *cobra.Command { return nil }, 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) traceProvider, err := tracing.GetTraceProvider(cmd.Context(), cfg.Commons.TracesExporter, cfg.Service.Name) if err != nil { return err diff --git a/services/idp/pkg/config/config.go b/services/idp/pkg/config/config.go index 31a02deb8..08658dadc 100644 --- a/services/idp/pkg/config/config.go +++ b/services/idp/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:"level" env:"OC_LOG_LEVEL;IDP_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + Debug Debug `yaml:"debug"` HTTP HTTP `yaml:"http"` diff --git a/services/idp/pkg/config/defaults/defaultconfig.go b/services/idp/pkg/config/defaults/defaultconfig.go index 09c07d957..356f71e7d 100644 --- a/services/idp/pkg/config/defaults/defaultconfig.go +++ b/services/idp/pkg/config/defaults/defaultconfig.go @@ -138,16 +138,8 @@ func DefaultConfig() *config.Config { // EnsureDefaults adds default values to the configuration if they are not set yet func EnsureDefaults(cfg *config.Config) { - // provide with defaults for shared logging, since we need a valid destination address for "envdecode". - 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" } if cfg.Reva == nil && cfg.Commons != nil { diff --git a/services/idp/pkg/config/log.go b/services/idp/pkg/config/log.go deleted file mode 100644 index 5819a2c8a..000000000 --- a/services/idp/pkg/config/log.go +++ /dev/null @@ -1,9 +0,0 @@ -package config - -// Log defines the available log configuration. -type Log struct { - Level string `yaml:"level" env:"OC_LOG_LEVEL;IDP_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` - Pretty bool `yaml:"pretty" env:"OC_LOG_PRETTY;IDP_LOG_PRETTY" desc:"Activates pretty log output." introductionVersion:"1.0.0"` - Color bool `yaml:"color" env:"OC_LOG_COLOR;IDP_LOG_COLOR" desc:"Activates colorized log output." introductionVersion:"1.0.0"` - File string `yaml:"file" env:"OC_LOG_FILE;IDP_LOG_FILE" desc:"The path to the log file. Activates logging to this file if set." introductionVersion:"1.0.0"` -} diff --git a/services/idp/pkg/logging/logging.go b/services/idp/pkg/logging/logging.go deleted file mode 100644 index 44172d88c..000000000 --- a/services/idp/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/idp/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), - ) -} From e0d126da5c89b5b2fed6447360e7a9f6dcc54ff2 Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Thu, 8 Jan 2026 13:00:02 +0100 Subject: [PATCH 21/45] consolidate log config in invitations Signed-off-by: Christian Richter --- services/invitations/pkg/command/health.go | 4 ++-- services/invitations/pkg/command/server.go | 4 ++-- services/invitations/pkg/config/config.go | 4 ++-- .../pkg/config/defaults/defaultconfig.go | 12 ++---------- services/invitations/pkg/config/log.go | 9 --------- services/invitations/pkg/logging/logging.go | 17 ----------------- 6 files changed, 8 insertions(+), 42 deletions(-) delete mode 100644 services/invitations/pkg/config/log.go delete mode 100644 services/invitations/pkg/logging/logging.go diff --git a/services/invitations/pkg/command/health.go b/services/invitations/pkg/command/health.go index 05fddacdb..ce498f550 100644 --- a/services/invitations/pkg/command/health.go +++ b/services/invitations/pkg/command/health.go @@ -5,9 +5,9 @@ import ( "net/http" "github.com/opencloud-eu/opencloud/pkg/config/configlog" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/services/invitations/pkg/config" "github.com/opencloud-eu/opencloud/services/invitations/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/invitations/pkg/logging" "github.com/spf13/cobra" ) @@ -21,7 +21,7 @@ func Health(cfg *config.Config) *cobra.Command { return configlog.ReturnError(parser.ParseConfig(cfg)) }, 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) resp, err := http.Get( fmt.Sprintf( diff --git a/services/invitations/pkg/command/server.go b/services/invitations/pkg/command/server.go index be6644c55..23cf31690 100644 --- a/services/invitations/pkg/command/server.go +++ b/services/invitations/pkg/command/server.go @@ -6,12 +6,12 @@ import ( "os/signal" "github.com/opencloud-eu/opencloud/pkg/config/configlog" + "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/pkg/version" "github.com/opencloud-eu/opencloud/services/invitations/pkg/config" "github.com/opencloud-eu/opencloud/services/invitations/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/invitations/pkg/logging" "github.com/opencloud-eu/opencloud/services/invitations/pkg/metrics" "github.com/opencloud-eu/opencloud/services/invitations/pkg/server/debug" "github.com/opencloud-eu/opencloud/services/invitations/pkg/server/http" @@ -29,7 +29,7 @@ func Server(cfg *config.Config) *cobra.Command { return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, 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) traceProvider, err := tracing.GetTraceProvider(cmd.Context(), cfg.Commons.TracesExporter, cfg.Service.Name) if err != nil { return err diff --git a/services/invitations/pkg/config/config.go b/services/invitations/pkg/config/config.go index b3b363f10..f7a9eaac0 100644 --- a/services/invitations/pkg/config/config.go +++ b/services/invitations/pkg/config/config.go @@ -12,8 +12,8 @@ type Config struct { Service Service `yaml:"-"` - Log *Log `yaml:"log"` - Debug Debug `yaml:"debug"` + LogLevel string `mapstructure:"level" env:"OC_LOG_LEVEL;INVITATIONS_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + Debug Debug `yaml:"debug"` HTTP HTTP `yaml:"http"` diff --git a/services/invitations/pkg/config/defaults/defaultconfig.go b/services/invitations/pkg/config/defaults/defaultconfig.go index 664815e3d..efa629e25 100644 --- a/services/invitations/pkg/config/defaults/defaultconfig.go +++ b/services/invitations/pkg/config/defaults/defaultconfig.go @@ -43,16 +43,8 @@ func DefaultConfig() *config.Config { } func EnsureDefaults(cfg *config.Config) { - // provide with defaults for shared logging, since we need a valid destination address for "envdecode". - 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" } if cfg.Commons != nil { diff --git a/services/invitations/pkg/config/log.go b/services/invitations/pkg/config/log.go deleted file mode 100644 index 47844f1dc..000000000 --- a/services/invitations/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;INVITATIONS_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;INVITATIONS_LOG_PRETTY" desc:"Activates pretty log output." introductionVersion:"1.0.0"` - Color bool `mapstructure:"color" env:"OC_LOG_COLOR;INVITATIONS_LOG_COLOR" desc:"Activates colorized log output." introductionVersion:"1.0.0"` - File string `mapstructure:"file" env:"OC_LOG_FILE;INVITATIONS_LOG_FILE" desc:"The path to the log file. Activates logging to this file if set." introductionVersion:"1.0.0"` -} diff --git a/services/invitations/pkg/logging/logging.go b/services/invitations/pkg/logging/logging.go deleted file mode 100644 index f58d014aa..000000000 --- a/services/invitations/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/invitations/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), - ) -} From 92562965cbcb6fbac9c8a60825aa6a04ae2258bd Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Thu, 8 Jan 2026 13:01:40 +0100 Subject: [PATCH 22/45] consolidate log config in nats Signed-off-by: Christian Richter --- services/nats/pkg/command/server.go | 3 ++- services/nats/pkg/config/config.go | 8 ++++---- .../nats/pkg/config/defaults/defaultconfig.go | 13 ++----------- services/nats/pkg/config/log.go | 9 --------- services/nats/pkg/logging/logging.go | 17 ----------------- 5 files changed, 8 insertions(+), 42 deletions(-) delete mode 100644 services/nats/pkg/config/log.go delete mode 100644 services/nats/pkg/logging/logging.go diff --git a/services/nats/pkg/command/server.go b/services/nats/pkg/command/server.go index 3bf916938..342036167 100644 --- a/services/nats/pkg/command/server.go +++ b/services/nats/pkg/command/server.go @@ -8,6 +8,7 @@ import ( "github.com/opencloud-eu/opencloud/pkg/config/configlog" pkgcrypto "github.com/opencloud-eu/opencloud/pkg/crypto" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/pkg/runner" "github.com/opencloud-eu/opencloud/services/nats/pkg/config" "github.com/opencloud-eu/opencloud/services/nats/pkg/config/parser" @@ -27,7 +28,7 @@ func Server(cfg *config.Config) *cobra.Command { return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, 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/nats/pkg/config/config.go b/services/nats/pkg/config/config.go index 3f4cb34eb..0cda2038b 100644 --- a/services/nats/pkg/config/config.go +++ b/services/nats/pkg/config/config.go @@ -8,10 +8,10 @@ import ( // Config combines all available configuration parts. type Config struct { - Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service - Service Service `yaml:"-"` - Log *Log `yaml:"log"` - Debug Debug `yaml:"debug"` + Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service + Service Service `yaml:"-"` + LogLevel string `mapstructure:"level" env:"OC_LOG_LEVEL;NATS_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + Debug Debug `yaml:"debug"` Nats Nats `ociConfig:"nats"` diff --git a/services/nats/pkg/config/defaults/defaultconfig.go b/services/nats/pkg/config/defaults/defaultconfig.go index 05a2f4e34..52dcfda07 100644 --- a/services/nats/pkg/config/defaults/defaultconfig.go +++ b/services/nats/pkg/config/defaults/defaultconfig.go @@ -44,18 +44,9 @@ func DefaultConfig() *config.Config { // EnsureDefaults adds default values to the configuration if they are not set yet func EnsureDefaults(cfg *config.Config) { - // provide with defaults for shared logging, since we need a valid destination address for "envdecode". - 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 sanitizes the configuration diff --git a/services/nats/pkg/config/log.go b/services/nats/pkg/config/log.go deleted file mode 100644 index 1b0340b72..000000000 --- a/services/nats/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;NATS_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;NATS_LOG_PRETTY" desc:"Activates pretty log output." introductionVersion:"1.0.0"` - Color bool `mapstructure:"color" env:"OC_LOG_COLOR;NATS_LOG_COLOR" desc:"Activates colorized log output." introductionVersion:"1.0.0"` - File string `mapstructure:"file" env:"OC_LOG_FILE;NATS_LOG_FILE" desc:"The path to the log file. Activates logging to this file if set." introductionVersion:"1.0.0"` -} diff --git a/services/nats/pkg/logging/logging.go b/services/nats/pkg/logging/logging.go deleted file mode 100644 index e3b93418b..000000000 --- a/services/nats/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/nats/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), - ) -} From bd586b7a55abb19f33c4ec0d430b90f40637421f Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Thu, 8 Jan 2026 13:04:27 +0100 Subject: [PATCH 23/45] consolidate log config in notifications Signed-off-by: Christian Richter --- services/notifications/pkg/command/server.go | 4 ++-- services/notifications/pkg/config/config.go | 4 ++-- .../pkg/config/defaults/defaultconfig.go | 12 ++---------- services/notifications/pkg/config/log.go | 9 --------- .../notifications/pkg/config/parser/parse.go | 7 +++---- services/notifications/pkg/logging/logging.go | 17 ----------------- 6 files changed, 9 insertions(+), 44 deletions(-) delete mode 100644 services/notifications/pkg/config/log.go delete mode 100644 services/notifications/pkg/logging/logging.go diff --git a/services/notifications/pkg/command/server.go b/services/notifications/pkg/command/server.go index 7c2896abe..e512286a6 100644 --- a/services/notifications/pkg/command/server.go +++ b/services/notifications/pkg/command/server.go @@ -8,6 +8,7 @@ import ( "github.com/opencloud-eu/opencloud/pkg/config/configlog" "github.com/opencloud-eu/opencloud/pkg/generators" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/pkg/registry" "github.com/opencloud-eu/opencloud/pkg/runner" "github.com/opencloud-eu/opencloud/pkg/service/grpc" @@ -16,7 +17,6 @@ import ( "github.com/opencloud-eu/opencloud/services/notifications/pkg/channels" "github.com/opencloud-eu/opencloud/services/notifications/pkg/config" "github.com/opencloud-eu/opencloud/services/notifications/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/notifications/pkg/logging" "github.com/opencloud-eu/opencloud/services/notifications/pkg/server/debug" "github.com/opencloud-eu/opencloud/services/notifications/pkg/service" "github.com/opencloud-eu/reva/v2/pkg/events" @@ -38,7 +38,7 @@ func Server(cfg *config.Config) *cobra.Command { return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, 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) traceProvider, err := tracing.GetTraceProvider(cmd.Context(), cfg.Commons.TracesExporter, cfg.Service.Name) if err != nil { diff --git a/services/notifications/pkg/config/config.go b/services/notifications/pkg/config/config.go index afc825384..f6a6d4b89 100644 --- a/services/notifications/pkg/config/config.go +++ b/services/notifications/pkg/config/config.go @@ -14,8 +14,8 @@ type Config struct { Service Service `yaml:"-"` - Log *Log `yaml:"log"` - Debug Debug `yaml:"debug"` + LogLevel string `yaml:"level" env:"OC_LOG_LEVEL;NOTIFICATIONS_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + Debug Debug `yaml:"debug"` WebUIURL string `yaml:"opencloud_url" env:"OC_URL;NOTIFICATIONS_WEB_UI_URL" desc:"The public facing URL of the OpenCloud Web UI, used e.g. when sending notification eMails" introductionVersion:"1.0.0"` diff --git a/services/notifications/pkg/config/defaults/defaultconfig.go b/services/notifications/pkg/config/defaults/defaultconfig.go index 3e2a07b54..bc49caa14 100644 --- a/services/notifications/pkg/config/defaults/defaultconfig.go +++ b/services/notifications/pkg/config/defaults/defaultconfig.go @@ -54,16 +54,8 @@ func DefaultConfig() *config.Config { // EnsureDefaults adds default values to the configuration if they are not set yet func EnsureDefaults(cfg *config.Config) { - // provide with defaults for shared logging, since we need a valid destination address for "envdecode". - 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" } if cfg.Notifications.GRPCClientTLS == nil && cfg.Commons != nil { diff --git a/services/notifications/pkg/config/log.go b/services/notifications/pkg/config/log.go deleted file mode 100644 index 4dcffea9c..000000000 --- a/services/notifications/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;NOTIFICATIONS_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;NOTIFICATIONS_LOG_PRETTY" desc:"Activates pretty log output." introductionVersion:"1.0.0"` - Color bool `mapstructure:"color" env:"OC_LOG_COLOR;NOTIFICATIONS_LOG_COLOR" desc:"Activates colorized log output." introductionVersion:"1.0.0"` - File string `mapstructure:"file" env:"OC_LOG_FILE;NOTIFICATIONS_LOG_FILE" desc:"The path to the log file. Activates logging to this file if set." introductionVersion:"1.0.0"` -} diff --git a/services/notifications/pkg/config/parser/parse.go b/services/notifications/pkg/config/parser/parse.go index 57e78886c..33df96694 100644 --- a/services/notifications/pkg/config/parser/parse.go +++ b/services/notifications/pkg/config/parser/parse.go @@ -7,12 +7,11 @@ import ( "strings" occfg "github.com/opencloud-eu/opencloud/pkg/config" + "github.com/opencloud-eu/opencloud/pkg/config/envdecode" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/pkg/shared" "github.com/opencloud-eu/opencloud/services/notifications/pkg/config" "github.com/opencloud-eu/opencloud/services/notifications/pkg/config/defaults" - "github.com/opencloud-eu/opencloud/services/notifications/pkg/logging" - - "github.com/opencloud-eu/opencloud/pkg/config/envdecode" ) // ParseConfig loads configuration from known paths. @@ -38,7 +37,7 @@ func ParseConfig(cfg *config.Config) error { } func Validate(cfg *config.Config) error { - logger := logging.Configure(cfg.Service.Name, cfg.Log) + logger := log.Configure(cfg.Service.Name, cfg.Commons, cfg.LogLevel) if cfg.Notifications.SMTP.Host != "" { switch cfg.Notifications.SMTP.Encryption { diff --git a/services/notifications/pkg/logging/logging.go b/services/notifications/pkg/logging/logging.go deleted file mode 100644 index 1c33af770..000000000 --- a/services/notifications/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/notifications/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), - ) -} From 419edec7cc60c8e3f0bd47eedd7916b353b510de Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Thu, 8 Jan 2026 13:06:42 +0100 Subject: [PATCH 24/45] consolidate log config in ocm Signed-off-by: Christian Richter --- services/ocm/pkg/command/server.go | 4 ++-- services/ocm/pkg/config/config.go | 4 ++-- .../ocm/pkg/config/defaults/defaultconfig.go | 12 ++---------- services/ocm/pkg/config/log.go | 9 --------- services/ocm/pkg/logging/logging.go | 17 ----------------- 5 files changed, 6 insertions(+), 40 deletions(-) delete mode 100644 services/ocm/pkg/config/log.go delete mode 100644 services/ocm/pkg/logging/logging.go diff --git a/services/ocm/pkg/command/server.go b/services/ocm/pkg/command/server.go index dbb6d8ab1..b6d06ed89 100644 --- a/services/ocm/pkg/command/server.go +++ b/services/ocm/pkg/command/server.go @@ -6,13 +6,13 @@ import ( "os/signal" "github.com/opencloud-eu/opencloud/pkg/config/configlog" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/pkg/registry" "github.com/opencloud-eu/opencloud/pkg/runner" "github.com/opencloud-eu/opencloud/pkg/tracing" "github.com/opencloud-eu/opencloud/pkg/version" "github.com/opencloud-eu/opencloud/services/ocm/pkg/config" "github.com/opencloud-eu/opencloud/services/ocm/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/ocm/pkg/logging" "github.com/opencloud-eu/opencloud/services/ocm/pkg/revaconfig" "github.com/opencloud-eu/opencloud/services/ocm/pkg/server/debug" "github.com/opencloud-eu/reva/v2/cmd/revad/runtime" @@ -29,7 +29,7 @@ func Server(cfg *config.Config) *cobra.Command { return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, 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) traceProvider, err := tracing.GetTraceProvider(cmd.Context(), cfg.Commons.TracesExporter, cfg.Service.Name) if err != nil { return err diff --git a/services/ocm/pkg/config/config.go b/services/ocm/pkg/config/config.go index 1ebff7ea5..b9a36906b 100644 --- a/services/ocm/pkg/config/config.go +++ b/services/ocm/pkg/config/config.go @@ -15,8 +15,8 @@ type Config struct { Service Service `yaml:"-"` - Log *Log `yaml:"log"` - Debug Debug `yaml:"debug"` + LogLevel string `yaml:"loglevel" env:"OC_LOG_LEVEL;OCM_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + Debug Debug `yaml:"debug"` HTTP HTTPConfig `yaml:"http"` Middleware Middleware `yaml:"middleware"` diff --git a/services/ocm/pkg/config/defaults/defaultconfig.go b/services/ocm/pkg/config/defaults/defaultconfig.go index 5af3d3e86..3042c94c5 100644 --- a/services/ocm/pkg/config/defaults/defaultconfig.go +++ b/services/ocm/pkg/config/defaults/defaultconfig.go @@ -140,16 +140,8 @@ func DefaultConfig() *config.Config { // EnsureDefaults ensures the config contains default values func EnsureDefaults(cfg *config.Config) { - // provide with defaults for shared logging, since we need a valid destination address for "envdecode". - 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" } if cfg.Reva == nil && cfg.Commons != nil { diff --git a/services/ocm/pkg/config/log.go b/services/ocm/pkg/config/log.go deleted file mode 100644 index 45b91ca14..000000000 --- a/services/ocm/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;OCM_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;OCM_LOG_PRETTY" desc:"Activates pretty log output." introductionVersion:"1.0.0"` - Color bool `mapstructure:"color" env:"OC_LOG_COLOR;OCM_LOG_COLOR" desc:"Activates colorized log output." introductionVersion:"1.0.0"` - File string `mapstructure:"file" env:"OC_LOG_FILE;OCM_LOG_FILE" desc:"The path to the log file. Activates logging to this file if set." introductionVersion:"1.0.0"` -} diff --git a/services/ocm/pkg/logging/logging.go b/services/ocm/pkg/logging/logging.go deleted file mode 100644 index 6ff4a3a3e..000000000 --- a/services/ocm/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/ocm/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), - ) -} From d9423e2c70584397550482320bae35e3e11c8b6f Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Thu, 8 Jan 2026 13:08:45 +0100 Subject: [PATCH 25/45] consolidate log config in ocs Signed-off-by: Christian Richter --- services/ocs/pkg/command/health.go | 4 ++-- services/ocs/pkg/command/server.go | 4 ++-- services/ocs/pkg/config/config.go | 4 ++-- .../ocs/pkg/config/defaults/defaultconfig.go | 12 ++---------- services/ocs/pkg/config/log.go | 9 --------- services/ocs/pkg/logging/logging.go | 17 ----------------- 6 files changed, 8 insertions(+), 42 deletions(-) delete mode 100644 services/ocs/pkg/config/log.go delete mode 100644 services/ocs/pkg/logging/logging.go diff --git a/services/ocs/pkg/command/health.go b/services/ocs/pkg/command/health.go index 297204d88..487b7e529 100644 --- a/services/ocs/pkg/command/health.go +++ b/services/ocs/pkg/command/health.go @@ -5,9 +5,9 @@ import ( "net/http" "github.com/opencloud-eu/opencloud/pkg/config/configlog" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/services/ocs/pkg/config" "github.com/opencloud-eu/opencloud/services/ocs/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/ocs/pkg/logging" "github.com/spf13/cobra" ) @@ -21,7 +21,7 @@ func Health(cfg *config.Config) *cobra.Command { return configlog.ReturnError(parser.ParseConfig(cfg)) }, 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) resp, err := http.Get( fmt.Sprintf( diff --git a/services/ocs/pkg/command/server.go b/services/ocs/pkg/command/server.go index a28cef5b5..87048b29a 100644 --- a/services/ocs/pkg/command/server.go +++ b/services/ocs/pkg/command/server.go @@ -6,13 +6,13 @@ import ( "os/signal" "github.com/opencloud-eu/opencloud/pkg/config/configlog" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/pkg/runner" ogrpc "github.com/opencloud-eu/opencloud/pkg/service/grpc" "github.com/opencloud-eu/opencloud/pkg/tracing" "github.com/opencloud-eu/opencloud/pkg/version" "github.com/opencloud-eu/opencloud/services/ocs/pkg/config" "github.com/opencloud-eu/opencloud/services/ocs/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/ocs/pkg/logging" "github.com/opencloud-eu/opencloud/services/ocs/pkg/metrics" "github.com/opencloud-eu/opencloud/services/ocs/pkg/server/debug" "github.com/opencloud-eu/opencloud/services/ocs/pkg/server/http" @@ -29,7 +29,7 @@ func Server(cfg *config.Config) *cobra.Command { return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, 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) traceProvider, err := tracing.GetTraceProvider(cmd.Context(), cfg.Commons.TracesExporter, cfg.Service.Name) if err != nil { return err diff --git a/services/ocs/pkg/config/config.go b/services/ocs/pkg/config/config.go index 46c4e440b..bbfbe587e 100644 --- a/services/ocs/pkg/config/config.go +++ b/services/ocs/pkg/config/config.go @@ -14,8 +14,8 @@ type Config struct { Service Service `yaml:"-"` - Log *Log `yaml:"log"` - Debug Debug `yaml:"debug"` + LogLevel string `yaml:"loglevel" env:"OC_LOG_LEVEL;OCS_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + Debug Debug `yaml:"debug"` HTTP HTTP `yaml:"http"` diff --git a/services/ocs/pkg/config/defaults/defaultconfig.go b/services/ocs/pkg/config/defaults/defaultconfig.go index 1b0a7d55c..59872940c 100644 --- a/services/ocs/pkg/config/defaults/defaultconfig.go +++ b/services/ocs/pkg/config/defaults/defaultconfig.go @@ -49,16 +49,8 @@ func DefaultConfig() *config.Config { // EnsureDefaults adds default values to the configuration if they are not set yet func EnsureDefaults(cfg *config.Config) { - // provide with defaults for shared logging, since we need a valid destination address for "envdecode". - 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" } if cfg.TokenManager == nil && cfg.Commons != nil && cfg.Commons.TokenManager != nil { diff --git a/services/ocs/pkg/config/log.go b/services/ocs/pkg/config/log.go deleted file mode 100644 index 0b6dd980f..000000000 --- a/services/ocs/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;OCS_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;OCS_LOG_PRETTY" desc:"Activates pretty log output." introductionVersion:"1.0.0"` - Color bool `mapstructure:"color" env:"OC_LOG_COLOR;OCS_LOG_COLOR" desc:"Activates colorized log output." introductionVersion:"1.0.0"` - File string `mapstructure:"file" env:"OC_LOG_FILE;OCS_LOG_FILE" desc:"The path to the log file. Activates logging to this file if set." introductionVersion:"1.0.0"` -} diff --git a/services/ocs/pkg/logging/logging.go b/services/ocs/pkg/logging/logging.go deleted file mode 100644 index f6970a2a8..000000000 --- a/services/ocs/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/ocs/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), - ) -} From 5c2325386709fe25685cb5866017e1fbd008d5b5 Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Thu, 8 Jan 2026 13:11:26 +0100 Subject: [PATCH 26/45] consolidate log config in policies Signed-off-by: Christian Richter --- services/policies/pkg/command/health.go | 8 +------- services/policies/pkg/command/server.go | 8 +------- services/policies/pkg/config/config.go | 10 +--------- .../policies/pkg/config/defaults/defaultconfig.go | 11 ++--------- 4 files changed, 5 insertions(+), 32 deletions(-) diff --git a/services/policies/pkg/command/health.go b/services/policies/pkg/command/health.go index 15d18fa3e..223b074be 100644 --- a/services/policies/pkg/command/health.go +++ b/services/policies/pkg/command/health.go @@ -21,13 +21,7 @@ func Health(cfg *config.Config) *cobra.Command { return configlog.ReturnError(parser.ParseConfig(cfg)) }, RunE: func(cmd *cobra.Command, args []string) error { - logger := log.NewLogger( - log.Name(cfg.Service.Name), - log.Level(cfg.Log.Level), - log.Pretty(cfg.Log.Pretty), - log.Color(cfg.Log.Color), - log.File(cfg.Log.File), - ) + logger := log.Configure(cfg.Service.Name, cfg.Commons, cfg.LogLevel) resp, err := http.Get( fmt.Sprintf( diff --git a/services/policies/pkg/command/server.go b/services/policies/pkg/command/server.go index 1d807a2ad..92802e34c 100644 --- a/services/policies/pkg/command/server.go +++ b/services/policies/pkg/command/server.go @@ -40,13 +40,7 @@ func Server(cfg *config.Config) *cobra.Command { } ctx := cfg.Context - logger := log.NewLogger( - log.Name(cfg.Service.Name), - log.Level(cfg.Log.Level), - log.Pretty(cfg.Log.Pretty), - log.Color(cfg.Log.Color), - log.File(cfg.Log.File), - ).SubloggerWithRequestID(ctx) + logger := log.Configure(cfg.Service.Name, cfg.Commons, cfg.LogLevel).SubloggerWithRequestID(ctx) traceProvider, err := tracing.GetTraceProvider(cmd.Context(), cfg.Commons.TracesExporter, cfg.Service.Name) if err != nil { diff --git a/services/policies/pkg/config/config.go b/services/policies/pkg/config/config.go index 15d311228..51bee34cb 100644 --- a/services/policies/pkg/config/config.go +++ b/services/policies/pkg/config/config.go @@ -16,7 +16,7 @@ type Config struct { Events Events `yaml:"events"` GRPCClientTLS *shared.GRPCClientTLS `yaml:"grpc_client_tls"` Context context.Context `yaml:"-"` - Log *Log `yaml:"log"` + LogLevel string `yaml:"loglevel" env:"OC_LOG_LEVEL;POLICIES_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` Engine Engine `yaml:"engine"` Postprocessing Postprocessing `yaml:"postprocessing"` } @@ -57,14 +57,6 @@ type Events struct { AuthPassword string `yaml:"password" env:"OC_EVENTS_AUTH_PASSWORD;POLICIES_EVENTS_AUTH_PASSWORD" desc:"The password to authenticate with the events broker. The events broker is the OpenCloud service which receives and delivers events between the services." introductionVersion:"1.0.0"` } -// Log defines the available log configuration. -type Log struct { - Level string `mapstructure:"level" env:"OC_LOG_LEVEL;POLICIES_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;POLICIES_LOG_PRETTY" desc:"Activates pretty log output." introductionVersion:"1.0.0"` - Color bool `mapstructure:"color" env:"OC_LOG_COLOR;POLICIES_LOG_COLOR" desc:"Activates colorized log output." introductionVersion:"1.0.0"` - File string `mapstructure:"file" env:"OC_LOG_FILE;POLICIES_LOG_FILE" desc:"The path to the log file. Activates logging to this file if set." introductionVersion:"1.0.0"` -} - // Debug defines the available debug configuration. type Debug struct { Addr string `yaml:"addr" env:"POLICIES_DEBUG_ADDR" desc:"Bind address of the debug server, where metrics, health, config and debug endpoints will be exposed." introductionVersion:"1.0.0"` diff --git a/services/policies/pkg/config/defaults/defaultconfig.go b/services/policies/pkg/config/defaults/defaultconfig.go index 2791396eb..45ff34185 100644 --- a/services/policies/pkg/config/defaults/defaultconfig.go +++ b/services/policies/pkg/config/defaults/defaultconfig.go @@ -43,15 +43,8 @@ func DefaultConfig() *config.Config { } func EnsureDefaults(cfg *config.Config) { - 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" } if cfg.GRPCClientTLS == nil && cfg.Commons != nil { From 86d4932195781961ab7a72463c1f7b7429c18d86 Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Thu, 8 Jan 2026 13:13:08 +0100 Subject: [PATCH 27/45] consolidate log config in postprocessing Signed-off-by: Christian Richter --- services/postprocessing/pkg/command/server.go | 4 ++-- services/postprocessing/pkg/config/config.go | 4 ++-- .../pkg/config/defaults/defaultconfig.go | 13 ++----------- services/postprocessing/pkg/config/log.go | 9 --------- services/postprocessing/pkg/logging/logging.go | 17 ----------------- 5 files changed, 6 insertions(+), 41 deletions(-) delete mode 100644 services/postprocessing/pkg/config/log.go delete mode 100644 services/postprocessing/pkg/logging/logging.go 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), - ) -} From 21975d75eb845d45664a75b459fae60e4d0dd371 Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Thu, 8 Jan 2026 13:16:55 +0100 Subject: [PATCH 28/45] consolidate log config in proxy Signed-off-by: Christian Richter --- services/proxy/pkg/command/health.go | 4 ++-- services/proxy/pkg/command/server.go | 3 +-- services/proxy/pkg/config/config.go | 4 ++-- .../proxy/pkg/config/defaults/defaultconfig.go | 12 ++---------- services/proxy/pkg/config/log.go | 9 --------- services/proxy/pkg/logging/logging.go | 17 ----------------- 6 files changed, 7 insertions(+), 42 deletions(-) delete mode 100644 services/proxy/pkg/config/log.go delete mode 100644 services/proxy/pkg/logging/logging.go diff --git a/services/proxy/pkg/command/health.go b/services/proxy/pkg/command/health.go index d3952f653..564335f6d 100644 --- a/services/proxy/pkg/command/health.go +++ b/services/proxy/pkg/command/health.go @@ -5,9 +5,9 @@ import ( "net/http" "github.com/opencloud-eu/opencloud/pkg/config/configlog" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/services/proxy/pkg/config" "github.com/opencloud-eu/opencloud/services/proxy/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/proxy/pkg/logging" "github.com/spf13/cobra" ) @@ -21,7 +21,7 @@ func Health(cfg *config.Config) *cobra.Command { return configlog.ReturnError(parser.ParseConfig(cfg)) }, 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) resp, err := http.Get( fmt.Sprintf( diff --git a/services/proxy/pkg/command/server.go b/services/proxy/pkg/command/server.go index 418dfc0e4..25c1d045d 100644 --- a/services/proxy/pkg/command/server.go +++ b/services/proxy/pkg/command/server.go @@ -24,7 +24,6 @@ import ( settingssvc "github.com/opencloud-eu/opencloud/protogen/gen/opencloud/services/settings/v0" "github.com/opencloud-eu/opencloud/services/proxy/pkg/config" "github.com/opencloud-eu/opencloud/services/proxy/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/proxy/pkg/logging" "github.com/opencloud-eu/opencloud/services/proxy/pkg/metrics" "github.com/opencloud-eu/opencloud/services/proxy/pkg/middleware" "github.com/opencloud-eu/opencloud/services/proxy/pkg/proxy" @@ -76,7 +75,7 @@ func Server(cfg *config.Config) *cobra.Command { store.Authentication(cfg.PreSignedURL.SigningKeys.AuthUsername, cfg.PreSignedURL.SigningKeys.AuthPassword), ) - logger := logging.Configure(cfg.Service.Name, cfg.Log) + logger := log.Configure(cfg.Service.Name, cfg.Commons, cfg.LogLevel) traceProvider, err := tracing.GetTraceProvider(cmd.Context(), cfg.Commons.TracesExporter, cfg.Service.Name) if err != nil { return err diff --git a/services/proxy/pkg/config/config.go b/services/proxy/pkg/config/config.go index 37143132b..3e0ec9308 100644 --- a/services/proxy/pkg/config/config.go +++ b/services/proxy/pkg/config/config.go @@ -14,8 +14,8 @@ type Config struct { Service Service `yaml:"-"` - Log *Log `yaml:"log"` - Debug Debug `yaml:"debug" mask:"struct"` + LogLevel string `yaml:"loglevel" env:"OC_LOG_LEVEL;PROXY_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + Debug Debug `yaml:"debug" mask:"struct"` HTTP HTTP `yaml:"http"` diff --git a/services/proxy/pkg/config/defaults/defaultconfig.go b/services/proxy/pkg/config/defaults/defaultconfig.go index 195d0bed7..187e52be6 100644 --- a/services/proxy/pkg/config/defaults/defaultconfig.go +++ b/services/proxy/pkg/config/defaults/defaultconfig.go @@ -298,16 +298,8 @@ func DefaultPolicies() []config.Policy { // EnsureDefaults adds default values to the configuration if they are not set yet func EnsureDefaults(cfg *config.Config) { - // provide with defaults for shared logging, since we need a valid destination address for "envdecode". - 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" } if cfg.OIDC.UserinfoCache == nil && cfg.Commons != nil && cfg.Commons.Cache != nil { diff --git a/services/proxy/pkg/config/log.go b/services/proxy/pkg/config/log.go deleted file mode 100644 index fdaeaed43..000000000 --- a/services/proxy/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;PROXY_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;PROXY_LOG_PRETTY" desc:"Activates pretty log output." introductionVersion:"1.0.0"` - Color bool `mapstructure:"color" env:"OC_LOG_COLOR;PROXY_LOG_COLOR" desc:"Activates colorized log output." introductionVersion:"1.0.0"` - File string `mapstructure:"file" env:"OC_LOG_FILE;PROXY_LOG_FILE" desc:"The path to the log file. Activates logging to this file if set." introductionVersion:"1.0.0"` -} diff --git a/services/proxy/pkg/logging/logging.go b/services/proxy/pkg/logging/logging.go deleted file mode 100644 index 79d37447d..000000000 --- a/services/proxy/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/proxy/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), - ) -} From f7caf637ce3327639366a72df0e62772358eefd1 Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Thu, 8 Jan 2026 13:18:45 +0100 Subject: [PATCH 29/45] consolidate log config in search Signed-off-by: Christian Richter --- services/search/pkg/command/health.go | 4 ++-- services/search/pkg/command/server.go | 4 ++-- services/search/pkg/config/config.go | 4 ++-- .../search/pkg/config/defaults/defaultconfig.go | 12 ++---------- services/search/pkg/config/log.go | 9 --------- services/search/pkg/logging/logging.go | 17 ----------------- 6 files changed, 8 insertions(+), 42 deletions(-) delete mode 100644 services/search/pkg/config/log.go delete mode 100644 services/search/pkg/logging/logging.go diff --git a/services/search/pkg/command/health.go b/services/search/pkg/command/health.go index d3c6d4070..60412aab9 100644 --- a/services/search/pkg/command/health.go +++ b/services/search/pkg/command/health.go @@ -4,9 +4,9 @@ import ( "fmt" "net/http" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/services/search/pkg/config" "github.com/opencloud-eu/opencloud/services/search/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/search/pkg/logging" "github.com/spf13/cobra" ) @@ -20,7 +20,7 @@ func Health(cfg *config.Config) *cobra.Command { return parser.ParseConfig(cfg) }, 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) resp, err := http.Get( fmt.Sprintf( diff --git a/services/search/pkg/command/server.go b/services/search/pkg/command/server.go index 67f398745..e7378079d 100644 --- a/services/search/pkg/command/server.go +++ b/services/search/pkg/command/server.go @@ -10,6 +10,7 @@ import ( "github.com/opencloud-eu/opencloud/pkg/config/configlog" "github.com/opencloud-eu/opencloud/pkg/generators" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/pkg/registry" "github.com/opencloud-eu/opencloud/pkg/runner" ogrpc "github.com/opencloud-eu/opencloud/pkg/service/grpc" @@ -19,7 +20,6 @@ import ( "github.com/opencloud-eu/opencloud/services/search/pkg/config" "github.com/opencloud-eu/opencloud/services/search/pkg/config/parser" "github.com/opencloud-eu/opencloud/services/search/pkg/content" - "github.com/opencloud-eu/opencloud/services/search/pkg/logging" "github.com/opencloud-eu/opencloud/services/search/pkg/metrics" "github.com/opencloud-eu/opencloud/services/search/pkg/opensearch" bleveQuery "github.com/opencloud-eu/opencloud/services/search/pkg/query/bleve" @@ -44,7 +44,7 @@ func Server(cfg *config.Config) *cobra.Command { return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, 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) traceProvider, err := tracing.GetTraceProvider(cmd.Context(), cfg.Commons.TracesExporter, cfg.Service.Name) if err != nil { return err diff --git a/services/search/pkg/config/config.go b/services/search/pkg/config/config.go index 0ea50423d..128061b76 100644 --- a/services/search/pkg/config/config.go +++ b/services/search/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;SEARCH_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + Debug Debug `yaml:"debug"` GRPC GRPCConfig `yaml:"grpc"` GrpcClient client.Client `yaml:"-"` diff --git a/services/search/pkg/config/defaults/defaultconfig.go b/services/search/pkg/config/defaults/defaultconfig.go index d55702f35..630cd24e7 100644 --- a/services/search/pkg/config/defaults/defaultconfig.go +++ b/services/search/pkg/config/defaults/defaultconfig.go @@ -70,16 +70,8 @@ func DefaultConfig() *config.Config { // EnsureDefaults adds default values to the configuration if they are not set yet func EnsureDefaults(cfg *config.Config) { - // provide with defaults for shared logging, since we need a valid destination address for "envdecode". - 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" } if cfg.TokenManager == nil && cfg.Commons != nil && cfg.Commons.TokenManager != nil { diff --git a/services/search/pkg/config/log.go b/services/search/pkg/config/log.go deleted file mode 100644 index b191960f5..000000000 --- a/services/search/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;SEARCH_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;SEARCH_LOG_PRETTY" desc:"Activates pretty log output." introductionVersion:"1.0.0"` - Color bool `mapstructure:"color" env:"OC_LOG_COLOR;SEARCH_LOG_COLOR" desc:"Activates colorized log output." introductionVersion:"1.0.0"` - File string `mapstructure:"file" env:"OC_LOG_FILE;SEARCH_LOG_FILE" desc:"The path to the log file. Activates logging to this file if set." introductionVersion:"1.0.0"` -} diff --git a/services/search/pkg/logging/logging.go b/services/search/pkg/logging/logging.go deleted file mode 100644 index 3627d1228..000000000 --- a/services/search/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/search/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), - ) -} From eadbb20ab24c4fc5c97f998bc77f916c8d98ec30 Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Thu, 8 Jan 2026 13:22:58 +0100 Subject: [PATCH 30/45] consolidate log config in settings Signed-off-by: Christian Richter --- services/settings/pkg/command/health.go | 4 ++-- services/settings/pkg/command/server.go | 4 ++-- services/settings/pkg/config/config.go | 4 ++-- .../pkg/config/defaults/defaultconfig.go | 12 ++---------- services/settings/pkg/config/log.go | 9 --------- services/settings/pkg/logging/logging.go | 17 ----------------- services/settings/pkg/store/metadata/store.go | 11 +++-------- 7 files changed, 11 insertions(+), 50 deletions(-) delete mode 100644 services/settings/pkg/config/log.go delete mode 100644 services/settings/pkg/logging/logging.go diff --git a/services/settings/pkg/command/health.go b/services/settings/pkg/command/health.go index be648868b..ab39debae 100644 --- a/services/settings/pkg/command/health.go +++ b/services/settings/pkg/command/health.go @@ -5,9 +5,9 @@ import ( "net/http" "github.com/opencloud-eu/opencloud/pkg/config/configlog" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/services/settings/pkg/config" "github.com/opencloud-eu/opencloud/services/settings/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/settings/pkg/logging" "github.com/spf13/cobra" ) @@ -21,7 +21,7 @@ func Health(cfg *config.Config) *cobra.Command { return configlog.ReturnError(parser.ParseConfig(cfg)) }, 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) resp, err := http.Get( fmt.Sprintf( diff --git a/services/settings/pkg/command/server.go b/services/settings/pkg/command/server.go index dc889f053..3a81994b0 100644 --- a/services/settings/pkg/command/server.go +++ b/services/settings/pkg/command/server.go @@ -6,13 +6,13 @@ import ( "os/signal" "github.com/opencloud-eu/opencloud/pkg/config/configlog" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/pkg/runner" ogrpc "github.com/opencloud-eu/opencloud/pkg/service/grpc" "github.com/opencloud-eu/opencloud/pkg/tracing" "github.com/opencloud-eu/opencloud/pkg/version" "github.com/opencloud-eu/opencloud/services/settings/pkg/config" "github.com/opencloud-eu/opencloud/services/settings/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/settings/pkg/logging" "github.com/opencloud-eu/opencloud/services/settings/pkg/metrics" "github.com/opencloud-eu/opencloud/services/settings/pkg/server/debug" "github.com/opencloud-eu/opencloud/services/settings/pkg/server/grpc" @@ -31,7 +31,7 @@ func Server(cfg *config.Config) *cobra.Command { return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, 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) traceProvider, err := tracing.GetTraceProvider(cmd.Context(), cfg.Commons.TracesExporter, cfg.Service.Name) if err != nil { return err diff --git a/services/settings/pkg/config/config.go b/services/settings/pkg/config/config.go index 17305a390..d4ba71e3c 100644 --- a/services/settings/pkg/config/config.go +++ b/services/settings/pkg/config/config.go @@ -15,8 +15,8 @@ type Config struct { Service Service `yaml:"-"` - Log *Log `yaml:"log"` - Debug Debug `yaml:"debug"` + LogLevel string `yaml:"loglevel" env:"OC_LOG_LEVEL;SETTINGS_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + Debug Debug `yaml:"debug"` HTTP HTTP `yaml:"http"` GRPC GRPCConfig `yaml:"grpc"` diff --git a/services/settings/pkg/config/defaults/defaultconfig.go b/services/settings/pkg/config/defaults/defaultconfig.go index b2c1df408..d881be54d 100644 --- a/services/settings/pkg/config/defaults/defaultconfig.go +++ b/services/settings/pkg/config/defaults/defaultconfig.go @@ -69,16 +69,8 @@ func DefaultConfig() *config.Config { // EnsureDefaults adds default values to the configuration if they are not set yet func EnsureDefaults(cfg *config.Config) { - // provide with defaults for shared logging, since we need a valid destination address for "envdecode". - 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" } if cfg.TokenManager == nil && cfg.Commons != nil && cfg.Commons.TokenManager != nil { diff --git a/services/settings/pkg/config/log.go b/services/settings/pkg/config/log.go deleted file mode 100644 index 458470484..000000000 --- a/services/settings/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;SETTINGS_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;SETTINGS_LOG_PRETTY" desc:"Activates pretty log output." introductionVersion:"1.0.0"` - Color bool `mapstructure:"color" env:"OC_LOG_COLOR;SETTINGS_LOG_COLOR" desc:"Activates colorized log output." introductionVersion:"1.0.0"` - File string `mapstructure:"file" env:"OC_LOG_FILE;SETTINGS_LOG_FILE" desc:"The path to the log file. Activates logging to this file if set." introductionVersion:"1.0.0"` -} diff --git a/services/settings/pkg/logging/logging.go b/services/settings/pkg/logging/logging.go deleted file mode 100644 index 0bb0210bf..000000000 --- a/services/settings/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/settings/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), - ) -} diff --git a/services/settings/pkg/store/metadata/store.go b/services/settings/pkg/store/metadata/store.go index b5684b377..c15b32702 100644 --- a/services/settings/pkg/store/metadata/store.go +++ b/services/settings/pkg/store/metadata/store.go @@ -74,14 +74,9 @@ func (s *Store) Init() { // New creates a new store func New(cfg *config.Config) settings.Manager { s := Store{ - Logger: olog.NewLogger( - olog.Color(cfg.Log.Color), - olog.Pretty(cfg.Log.Pretty), - olog.Level(cfg.Log.Level), - olog.File(cfg.Log.File), - ), - cfg: cfg, - l: &sync.Mutex{}, + Logger: olog.Configure(cfg.Service.Name, cfg.Commons, cfg.LogLevel), + cfg: cfg, + l: &sync.Mutex{}, } return &s From 0569e2005724275d1be836385181e32fd380ce22 Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Thu, 8 Jan 2026 13:25:35 +0100 Subject: [PATCH 31/45] consolidate log config in sharing Signed-off-by: Christian Richter --- services/sharing/pkg/command/health.go | 4 ++-- services/sharing/pkg/command/server.go | 4 ++-- services/sharing/pkg/config/config.go | 15 ++++----------- .../pkg/config/defaults/defaultconfig.go | 11 ++--------- services/sharing/pkg/logging/logging.go | 17 ----------------- 5 files changed, 10 insertions(+), 41 deletions(-) delete mode 100644 services/sharing/pkg/logging/logging.go diff --git a/services/sharing/pkg/command/health.go b/services/sharing/pkg/command/health.go index 3bbcc0cdb..d2a796bf1 100644 --- a/services/sharing/pkg/command/health.go +++ b/services/sharing/pkg/command/health.go @@ -5,9 +5,9 @@ import ( "net/http" "github.com/opencloud-eu/opencloud/pkg/config/configlog" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/services/sharing/pkg/config" "github.com/opencloud-eu/opencloud/services/sharing/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/sharing/pkg/logging" "github.com/spf13/cobra" ) @@ -21,7 +21,7 @@ func Health(cfg *config.Config) *cobra.Command { return configlog.ReturnError(parser.ParseConfig(cfg)) }, 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) resp, err := http.Get( fmt.Sprintf( diff --git a/services/sharing/pkg/command/server.go b/services/sharing/pkg/command/server.go index 14b2b17e5..5ac54ecfe 100644 --- a/services/sharing/pkg/command/server.go +++ b/services/sharing/pkg/command/server.go @@ -8,13 +8,13 @@ import ( "path/filepath" "github.com/opencloud-eu/opencloud/pkg/config/configlog" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/pkg/registry" "github.com/opencloud-eu/opencloud/pkg/runner" "github.com/opencloud-eu/opencloud/pkg/tracing" "github.com/opencloud-eu/opencloud/pkg/version" "github.com/opencloud-eu/opencloud/services/sharing/pkg/config" "github.com/opencloud-eu/opencloud/services/sharing/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/sharing/pkg/logging" "github.com/opencloud-eu/opencloud/services/sharing/pkg/revaconfig" "github.com/opencloud-eu/opencloud/services/sharing/pkg/server/debug" "github.com/opencloud-eu/reva/v2/cmd/revad/runtime" @@ -31,7 +31,7 @@ func Server(cfg *config.Config) *cobra.Command { return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, 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) traceProvider, err := tracing.GetTraceProvider(cmd.Context(), cfg.Commons.TracesExporter, cfg.Service.Name) if err != nil { return err diff --git a/services/sharing/pkg/config/config.go b/services/sharing/pkg/config/config.go index db279b98a..c7a231915 100644 --- a/services/sharing/pkg/config/config.go +++ b/services/sharing/pkg/config/config.go @@ -7,10 +7,10 @@ import ( ) type Config struct { - Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service - Service Service `yaml:"-"` - Log *Log `yaml:"log"` - Debug Debug `yaml:"debug"` + Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service + Service Service `yaml:"-"` + LogLevel string `yaml:"logevel" env:"OC_LOG_LEVEL;SHARING_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + Debug Debug `yaml:"debug"` GRPC GRPCConfig `yaml:"grpc"` @@ -32,13 +32,6 @@ type Config struct { Context context.Context `yaml:"-"` } -type Log struct { - Level string `yaml:"level" env:"OC_LOG_LEVEL;SHARING_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` - Pretty bool `yaml:"pretty" env:"OC_LOG_PRETTY;SHARING_LOG_PRETTY" desc:"Activates pretty log output." introductionVersion:"1.0.0"` - Color bool `yaml:"color" env:"OC_LOG_COLOR;SHARING_LOG_COLOR" desc:"Activates colorized log output." introductionVersion:"1.0.0"` - File string `yaml:"file" env:"OC_LOG_FILE;SHARING_LOG_FILE" desc:"The path to the log file. Activates logging to this file if set." introductionVersion:"1.0.0"` -} - type Service struct { Name string `yaml:"-"` } diff --git a/services/sharing/pkg/config/defaults/defaultconfig.go b/services/sharing/pkg/config/defaults/defaultconfig.go index cce41eae9..bf9432716 100644 --- a/services/sharing/pkg/config/defaults/defaultconfig.go +++ b/services/sharing/pkg/config/defaults/defaultconfig.go @@ -90,15 +90,8 @@ func DefaultConfig() *config.Config { // EnsureDefaults adds default values to the configuration if they are not set yet func EnsureDefaults(cfg *config.Config) { - // provide with defaults for shared logging, since we need a valid destination address for "envdecode". - 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" } if cfg.Reva == nil && cfg.Commons != nil { diff --git a/services/sharing/pkg/logging/logging.go b/services/sharing/pkg/logging/logging.go deleted file mode 100644 index 91eafadec..000000000 --- a/services/sharing/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/sharing/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), - ) -} From 7f8023ca8939c5c35be1b7821e497e227c106f08 Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Thu, 8 Jan 2026 13:27:37 +0100 Subject: [PATCH 32/45] consolidate log config in sse Signed-off-by: Christian Richter --- services/sse/pkg/command/health.go | 8 +------- services/sse/pkg/command/server.go | 8 +------- services/sse/pkg/config/config.go | 15 +++------------ services/sse/pkg/config/defaults/defaultconfig.go | 12 ++---------- 4 files changed, 7 insertions(+), 36 deletions(-) diff --git a/services/sse/pkg/command/health.go b/services/sse/pkg/command/health.go index 0eafc3e40..82d9444bc 100644 --- a/services/sse/pkg/command/health.go +++ b/services/sse/pkg/command/health.go @@ -21,13 +21,7 @@ func Health(cfg *config.Config) *cobra.Command { return configlog.ReturnError(parser.ParseConfig(cfg)) }, RunE: func(cmd *cobra.Command, args []string) error { - logger := log.NewLogger( - log.Name(cfg.Service.Name), - log.Level(cfg.Log.Level), - log.Pretty(cfg.Log.Pretty), - log.Color(cfg.Log.Color), - log.File(cfg.Log.File), - ) + logger := log.Configure(cfg.Service.Name, cfg.Commons, cfg.LogLevel) resp, err := http.Get( fmt.Sprintf( diff --git a/services/sse/pkg/command/server.go b/services/sse/pkg/command/server.go index feef04961..1dd0705f3 100644 --- a/services/sse/pkg/command/server.go +++ b/services/sse/pkg/command/server.go @@ -41,13 +41,7 @@ func Server(cfg *config.Config) *cobra.Command { } ctx := cfg.Context - logger := log.NewLogger( - log.Name(cfg.Service.Name), - log.Level(cfg.Log.Level), - log.Pretty(cfg.Log.Pretty), - log.Color(cfg.Log.Color), - log.File(cfg.Log.File), - ) + logger := log.Configure(cfg.Service.Name, cfg.Commons, cfg.LogLevel) tracerProvider, err := tracing.GetTraceProvider(cmd.Context(), cfg.Commons.TracesExporter, cfg.Service.Name) if err != nil { diff --git a/services/sse/pkg/config/config.go b/services/sse/pkg/config/config.go index a2948f588..0f7c46694 100644 --- a/services/sse/pkg/config/config.go +++ b/services/sse/pkg/config/config.go @@ -9,10 +9,9 @@ import ( // Config combines all available configuration parts. type Config struct { - Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service - Log *Log - - Debug Debug `mask:"struct" yaml:"debug"` + Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service + LogLevel string `yaml:"loglevel" env:"OC_LOG_LEVEL;SSE_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + Debug Debug `mask:"struct" yaml:"debug"` Service Service `yaml:"-"` KeepAliveInterval time.Duration `yaml:"keepalive_interval" env:"SSE_KEEPALIVE_INTERVAL" desc:"To prevent intermediate proxies from closing the SSE connection, send periodic SSE comments to keep it open." introductionVersion:"1.0.0"` @@ -29,14 +28,6 @@ type Service struct { Name string `yaml:"-"` } -// Log defines the available log configuration. -type Log struct { - Level string `mapstructure:"level" env:"OC_LOG_LEVEL;SSE_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;SSE_LOG_PRETTY" desc:"Activates pretty log output." introductionVersion:"1.0.0"` - Color bool `mapstructure:"color" env:"OC_LOG_COLOR;SSE_LOG_COLOR" desc:"Activates colorized log output." introductionVersion:"1.0.0"` - File string `mapstructure:"file" env:"OC_LOG_FILE;SSE_LOG_FILE" desc:"The path to the log file. Activates logging to this file if set." introductionVersion:"1.0.0"` -} - // Debug defines the available debug configuration. type Debug struct { Addr string `yaml:"addr" env:"SSE_DEBUG_ADDR" desc:"Bind address of the debug server, where metrics, health, config and debug endpoints will be exposed." introductionVersion:"1.0.0"` diff --git a/services/sse/pkg/config/defaults/defaultconfig.go b/services/sse/pkg/config/defaults/defaultconfig.go index 8ea79910f..30e2854ef 100644 --- a/services/sse/pkg/config/defaults/defaultconfig.go +++ b/services/sse/pkg/config/defaults/defaultconfig.go @@ -44,16 +44,8 @@ func DefaultConfig() *config.Config { // EnsureDefaults adds default values to the configuration if they are not set yet func EnsureDefaults(cfg *config.Config) { - // provide with defaults for shared logging, since we need a valid destination address for "envdecode". - 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" } if cfg.TokenManager == nil && cfg.Commons != nil && cfg.Commons.TokenManager != nil { From f5eacdc8b9f9d9567cfc319774749abad8220843 Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Thu, 8 Jan 2026 13:29:58 +0100 Subject: [PATCH 33/45] consolidate log config in storage-publiclink Signed-off-by: Christian Richter --- .../storage-publiclink/pkg/command/health.go | 4 ++-- .../storage-publiclink/pkg/command/server.go | 4 ++-- .../storage-publiclink/pkg/config/config.go | 15 ++++----------- .../pkg/config/defaults/defaultconfig.go | 12 ++---------- .../storage-publiclink/pkg/logging/logging.go | 17 ----------------- 5 files changed, 10 insertions(+), 42 deletions(-) delete mode 100644 services/storage-publiclink/pkg/logging/logging.go diff --git a/services/storage-publiclink/pkg/command/health.go b/services/storage-publiclink/pkg/command/health.go index 9ba9bacbd..926532821 100644 --- a/services/storage-publiclink/pkg/command/health.go +++ b/services/storage-publiclink/pkg/command/health.go @@ -5,9 +5,9 @@ import ( "net/http" "github.com/opencloud-eu/opencloud/pkg/config/configlog" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/services/storage-publiclink/pkg/config" "github.com/opencloud-eu/opencloud/services/storage-publiclink/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/storage-publiclink/pkg/logging" "github.com/spf13/cobra" ) @@ -21,7 +21,7 @@ func Health(cfg *config.Config) *cobra.Command { return configlog.ReturnError(parser.ParseConfig(cfg)) }, 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) resp, err := http.Get( fmt.Sprintf( diff --git a/services/storage-publiclink/pkg/command/server.go b/services/storage-publiclink/pkg/command/server.go index 12d417c76..36fb117ef 100644 --- a/services/storage-publiclink/pkg/command/server.go +++ b/services/storage-publiclink/pkg/command/server.go @@ -6,13 +6,13 @@ import ( "os/signal" "github.com/opencloud-eu/opencloud/pkg/config/configlog" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/pkg/registry" "github.com/opencloud-eu/opencloud/pkg/runner" "github.com/opencloud-eu/opencloud/pkg/tracing" "github.com/opencloud-eu/opencloud/pkg/version" "github.com/opencloud-eu/opencloud/services/storage-publiclink/pkg/config" "github.com/opencloud-eu/opencloud/services/storage-publiclink/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/storage-publiclink/pkg/logging" "github.com/opencloud-eu/opencloud/services/storage-publiclink/pkg/revaconfig" "github.com/opencloud-eu/opencloud/services/storage-publiclink/pkg/server/debug" "github.com/opencloud-eu/reva/v2/cmd/revad/runtime" @@ -29,7 +29,7 @@ func Server(cfg *config.Config) *cobra.Command { return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, 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) traceProvider, err := tracing.GetTraceProvider(cmd.Context(), cfg.Commons.TracesExporter, cfg.Service.Name) if err != nil { return err diff --git a/services/storage-publiclink/pkg/config/config.go b/services/storage-publiclink/pkg/config/config.go index c0728bc0d..26566fb08 100644 --- a/services/storage-publiclink/pkg/config/config.go +++ b/services/storage-publiclink/pkg/config/config.go @@ -7,10 +7,10 @@ import ( ) type Config struct { - Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service - Service Service `yaml:"-"` - Log *Log `yaml:"log"` - Debug Debug `yaml:"debug"` + Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service + Service Service `yaml:"-"` + LogLevel string `yaml:"loglevel" env:"OC_LOG_LEVEL;STORAGE_PUBLICLINK_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + Debug Debug `yaml:"debug"` GRPC GRPCConfig `yaml:"grpc"` @@ -24,13 +24,6 @@ type Config struct { Context context.Context `yaml:"-"` } -type Log struct { - Level string `yaml:"level" env:"OC_LOG_LEVEL;STORAGE_PUBLICLINK_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` - Pretty bool `yaml:"pretty" env:"OC_LOG_PRETTY;STORAGE_PUBLICLINK_LOG_PRETTY" desc:"Activates pretty log output." introductionVersion:"1.0.0"` - Color bool `yaml:"color" env:"OC_LOG_COLOR;STORAGE_PUBLICLINK_LOG_COLOR" desc:"Activates colorized log output." introductionVersion:"1.0.0"` - File string `yaml:"file" env:"OC_LOG_FILE;STORAGE_PUBLICLINK_LOG_FILE" desc:"The path to the log file. Activates logging to this file if set." introductionVersion:"1.0.0"` -} - type Service struct { Name string `yaml:"-"` } diff --git a/services/storage-publiclink/pkg/config/defaults/defaultconfig.go b/services/storage-publiclink/pkg/config/defaults/defaultconfig.go index 33f01baf1..b46cc89dd 100644 --- a/services/storage-publiclink/pkg/config/defaults/defaultconfig.go +++ b/services/storage-publiclink/pkg/config/defaults/defaultconfig.go @@ -40,16 +40,8 @@ func DefaultConfig() *config.Config { // EnsureDefaults adds default values to the configuration if they are not set yet func EnsureDefaults(cfg *config.Config) { - // provide with defaults for shared logging, since we need a valid destination address for "envdecode". - 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" } if cfg.Reva == nil && cfg.Commons != nil { diff --git a/services/storage-publiclink/pkg/logging/logging.go b/services/storage-publiclink/pkg/logging/logging.go deleted file mode 100644 index bee62d5aa..000000000 --- a/services/storage-publiclink/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/storage-publiclink/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), - ) -} From 245a77a813b48e6c7de010fd15816057b6656739 Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Thu, 8 Jan 2026 13:31:58 +0100 Subject: [PATCH 34/45] consolidate log config in storage-shares Signed-off-by: Christian Richter --- services/storage-shares/pkg/command/health.go | 4 ++-- services/storage-shares/pkg/command/server.go | 4 ++-- services/storage-shares/pkg/config/config.go | 14 ++++---------- .../pkg/config/defaults/defaultconfig.go | 13 ++----------- services/storage-shares/pkg/logging/logging.go | 17 ----------------- 5 files changed, 10 insertions(+), 42 deletions(-) delete mode 100644 services/storage-shares/pkg/logging/logging.go diff --git a/services/storage-shares/pkg/command/health.go b/services/storage-shares/pkg/command/health.go index cec693d01..2c745862f 100644 --- a/services/storage-shares/pkg/command/health.go +++ b/services/storage-shares/pkg/command/health.go @@ -5,9 +5,9 @@ import ( "net/http" "github.com/opencloud-eu/opencloud/pkg/config/configlog" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/services/storage-shares/pkg/config" "github.com/opencloud-eu/opencloud/services/storage-shares/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/storage-shares/pkg/logging" "github.com/spf13/cobra" ) @@ -21,7 +21,7 @@ func Health(cfg *config.Config) *cobra.Command { return configlog.ReturnError(parser.ParseConfig(cfg)) }, 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) resp, err := http.Get( fmt.Sprintf( diff --git a/services/storage-shares/pkg/command/server.go b/services/storage-shares/pkg/command/server.go index b53c1f48e..c1e1fa7ee 100644 --- a/services/storage-shares/pkg/command/server.go +++ b/services/storage-shares/pkg/command/server.go @@ -6,13 +6,13 @@ import ( "os/signal" "github.com/opencloud-eu/opencloud/pkg/config/configlog" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/pkg/registry" "github.com/opencloud-eu/opencloud/pkg/runner" "github.com/opencloud-eu/opencloud/pkg/tracing" "github.com/opencloud-eu/opencloud/pkg/version" "github.com/opencloud-eu/opencloud/services/storage-shares/pkg/config" "github.com/opencloud-eu/opencloud/services/storage-shares/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/storage-shares/pkg/logging" "github.com/opencloud-eu/opencloud/services/storage-shares/pkg/revaconfig" "github.com/opencloud-eu/opencloud/services/storage-shares/pkg/server/debug" "github.com/opencloud-eu/reva/v2/cmd/revad/runtime" @@ -29,7 +29,7 @@ func Server(cfg *config.Config) *cobra.Command { return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, 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) traceProvider, err := tracing.GetTraceProvider(cmd.Context(), cfg.Commons.TracesExporter, cfg.Service.Name) if err != nil { return err diff --git a/services/storage-shares/pkg/config/config.go b/services/storage-shares/pkg/config/config.go index 531a3752e..c51e18564 100644 --- a/services/storage-shares/pkg/config/config.go +++ b/services/storage-shares/pkg/config/config.go @@ -7,10 +7,10 @@ import ( ) type Config struct { - Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service - Service Service `yaml:"-"` - Log *Log `yaml:"log"` - Debug Debug `yaml:"debug"` + Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service + Service Service `yaml:"-"` + LogLevel string `yaml:"loglevel" env:"OC_LOG_LEVEL;STORAGE_SHARES_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + Debug Debug `yaml:"debug"` GRPC GRPCConfig `yaml:"grpc"` @@ -25,12 +25,6 @@ type Config struct { Context context.Context `yaml:"-"` } -type Log struct { - Level string `yaml:"level" env:"OC_LOG_LEVEL;STORAGE_SHARES_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` - Pretty bool `yaml:"pretty" env:"OC_LOG_PRETTY;STORAGE_SHARES_LOG_PRETTY" desc:"Activates pretty log output." introductionVersion:"1.0.0"` - Color bool `yaml:"color" env:"OC_LOG_COLOR;STORAGE_SHARES_LOG_COLOR" desc:"Activates colorized log output." introductionVersion:"1.0.0"` - File string `yaml:"file" env:"OC_LOG_FILE;STORAGE_SHARES_LOG_FILE" desc:"The path to the log file. Activates logging to this file if set." introductionVersion:"1.0.0"` -} type Service struct { Name string `yaml:"-"` diff --git a/services/storage-shares/pkg/config/defaults/defaultconfig.go b/services/storage-shares/pkg/config/defaults/defaultconfig.go index 28e2edcac..14489449a 100644 --- a/services/storage-shares/pkg/config/defaults/defaultconfig.go +++ b/services/storage-shares/pkg/config/defaults/defaultconfig.go @@ -40,18 +40,9 @@ func DefaultConfig() *config.Config { // EnsureDefaults adds default values to the configuration if they are not set yet func EnsureDefaults(cfg *config.Config) { - // provide with defaults for shared logging, since we need a valid destination address for "envdecode". - 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" } - if cfg.Reva == nil && cfg.Commons != nil { cfg.Reva = structs.CopyOrZeroValue(cfg.Commons.Reva) } diff --git a/services/storage-shares/pkg/logging/logging.go b/services/storage-shares/pkg/logging/logging.go deleted file mode 100644 index 4b0db494c..000000000 --- a/services/storage-shares/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/storage-shares/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), - ) -} From 6c46867a35c9a344de5859ebefd376ba99c89499 Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Thu, 8 Jan 2026 13:34:16 +0100 Subject: [PATCH 35/45] consolidate log config in storage-system Signed-off-by: Christian Richter --- services/storage-system/pkg/command/health.go | 4 ++-- services/storage-system/pkg/command/server.go | 4 ++-- services/storage-system/pkg/config/config.go | 16 ++++------------ .../pkg/config/defaults/defaultconfig.go | 13 ++----------- services/storage-system/pkg/logging/logging.go | 17 ----------------- 5 files changed, 10 insertions(+), 44 deletions(-) delete mode 100644 services/storage-system/pkg/logging/logging.go diff --git a/services/storage-system/pkg/command/health.go b/services/storage-system/pkg/command/health.go index 79d965998..291ea8dd3 100644 --- a/services/storage-system/pkg/command/health.go +++ b/services/storage-system/pkg/command/health.go @@ -5,9 +5,9 @@ import ( "net/http" "github.com/opencloud-eu/opencloud/pkg/config/configlog" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/services/storage-system/pkg/config" "github.com/opencloud-eu/opencloud/services/storage-system/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/storage-system/pkg/logging" "github.com/spf13/cobra" ) @@ -21,7 +21,7 @@ func Health(cfg *config.Config) *cobra.Command { return configlog.ReturnError(parser.ParseConfig(cfg)) }, 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) resp, err := http.Get( fmt.Sprintf( diff --git a/services/storage-system/pkg/command/server.go b/services/storage-system/pkg/command/server.go index b69315e3c..382cd2d0e 100644 --- a/services/storage-system/pkg/command/server.go +++ b/services/storage-system/pkg/command/server.go @@ -6,13 +6,13 @@ import ( "os/signal" "github.com/opencloud-eu/opencloud/pkg/config/configlog" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/pkg/registry" "github.com/opencloud-eu/opencloud/pkg/runner" "github.com/opencloud-eu/opencloud/pkg/tracing" "github.com/opencloud-eu/opencloud/pkg/version" "github.com/opencloud-eu/opencloud/services/storage-system/pkg/config" "github.com/opencloud-eu/opencloud/services/storage-system/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/storage-system/pkg/logging" "github.com/opencloud-eu/opencloud/services/storage-system/pkg/revaconfig" "github.com/opencloud-eu/opencloud/services/storage-system/pkg/server/debug" "github.com/opencloud-eu/reva/v2/cmd/revad/runtime" @@ -29,7 +29,7 @@ func Server(cfg *config.Config) *cobra.Command { return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, 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) traceProvider, err := tracing.GetTraceProvider(cmd.Context(), cfg.Commons.TracesExporter, cfg.Service.Name) if err != nil { return err diff --git a/services/storage-system/pkg/config/config.go b/services/storage-system/pkg/config/config.go index a8404c1dc..98f2ef0c8 100644 --- a/services/storage-system/pkg/config/config.go +++ b/services/storage-system/pkg/config/config.go @@ -9,10 +9,10 @@ import ( // Config holds Config config type Config struct { - Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service - Service Service `yaml:"-"` - Log *Log `yaml:"log"` - Debug Debug `yaml:"debug"` + Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service + Service Service `yaml:"-"` + LogLevel string `yaml:"loglevel" env:"OC_LOG_LEVEL;STORAGE_SYSTEM_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + Debug Debug `yaml:"debug"` GRPC GRPCConfig `yaml:"grpc"` HTTP HTTPConfig `yaml:"http"` @@ -33,14 +33,6 @@ type Config struct { Context context.Context `yaml:"-"` } -// Log holds Log config -type Log struct { - Level string `yaml:"level" env:"OC_LOG_LEVEL;STORAGE_SYSTEM_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` - Pretty bool `yaml:"pretty" env:"OC_LOG_PRETTY;STORAGE_SYSTEM_LOG_PRETTY" desc:"Activates pretty log output." introductionVersion:"1.0.0"` - Color bool `yaml:"color" env:"OC_LOG_COLOR;STORAGE_SYSTEM_LOG_COLOR" desc:"Activates colorized log output." introductionVersion:"1.0.0"` - File string `yaml:"file" env:"OC_LOG_FILE;STORAGE_SYSTEM_LOG_FILE" desc:"The path to the log file. Activates logging to this file if set." introductionVersion:"1.0.0"` -} - // Service holds Service config type Service struct { Name string `yaml:"-"` diff --git a/services/storage-system/pkg/config/defaults/defaultconfig.go b/services/storage-system/pkg/config/defaults/defaultconfig.go index e1de99edc..9608cd466 100644 --- a/services/storage-system/pkg/config/defaults/defaultconfig.go +++ b/services/storage-system/pkg/config/defaults/defaultconfig.go @@ -61,18 +61,9 @@ func DefaultConfig() *config.Config { // EnsureDefaults adds default values to the configuration if they are not set yet func EnsureDefaults(cfg *config.Config) { - // provide with defaults for shared logging, since we need a valid destination address for "envdecode". - 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" } - if cfg.Reva == nil && cfg.Commons != nil { cfg.Reva = structs.CopyOrZeroValue(cfg.Commons.Reva) } diff --git a/services/storage-system/pkg/logging/logging.go b/services/storage-system/pkg/logging/logging.go deleted file mode 100644 index 8aff7304f..000000000 --- a/services/storage-system/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/storage-system/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), - ) -} From 9b3fde49fe594206c82ae98902a66dc42af958a5 Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Thu, 8 Jan 2026 13:36:12 +0100 Subject: [PATCH 36/45] consolidate log config in storage-users Signed-off-by: Christian Richter --- services/storage-users/pkg/command/health.go | 4 ++-- services/storage-users/pkg/command/server.go | 4 ++-- services/storage-users/pkg/config/config.go | 16 ++++------------ .../pkg/config/defaults/defaultconfig.go | 12 ++---------- services/storage-users/pkg/logging/logging.go | 17 ----------------- 5 files changed, 10 insertions(+), 43 deletions(-) delete mode 100644 services/storage-users/pkg/logging/logging.go diff --git a/services/storage-users/pkg/command/health.go b/services/storage-users/pkg/command/health.go index 802cec278..aab48cbaa 100644 --- a/services/storage-users/pkg/command/health.go +++ b/services/storage-users/pkg/command/health.go @@ -5,9 +5,9 @@ import ( "net/http" "github.com/opencloud-eu/opencloud/pkg/config/configlog" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/services/storage-users/pkg/config" "github.com/opencloud-eu/opencloud/services/storage-users/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/storage-users/pkg/logging" "github.com/spf13/cobra" ) @@ -21,7 +21,7 @@ func Health(cfg *config.Config) *cobra.Command { return configlog.ReturnError(parser.ParseConfig(cfg)) }, 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) resp, err := http.Get( fmt.Sprintf( diff --git a/services/storage-users/pkg/command/server.go b/services/storage-users/pkg/command/server.go index 1b7bb72be..5e05ebd94 100644 --- a/services/storage-users/pkg/command/server.go +++ b/services/storage-users/pkg/command/server.go @@ -6,6 +6,7 @@ import ( "os/signal" "github.com/opencloud-eu/opencloud/pkg/config/configlog" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/pkg/registry" "github.com/opencloud-eu/opencloud/pkg/runner" "github.com/opencloud-eu/opencloud/pkg/tracing" @@ -13,7 +14,6 @@ import ( "github.com/opencloud-eu/opencloud/services/storage-users/pkg/config" "github.com/opencloud-eu/opencloud/services/storage-users/pkg/config/parser" "github.com/opencloud-eu/opencloud/services/storage-users/pkg/event" - "github.com/opencloud-eu/opencloud/services/storage-users/pkg/logging" "github.com/opencloud-eu/opencloud/services/storage-users/pkg/revaconfig" "github.com/opencloud-eu/opencloud/services/storage-users/pkg/server/debug" "github.com/opencloud-eu/reva/v2/cmd/revad/runtime" @@ -31,7 +31,7 @@ func Server(cfg *config.Config) *cobra.Command { return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, 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) traceProvider, err := tracing.GetTraceProvider(cmd.Context(), cfg.Commons.TracesExporter, cfg.Service.Name) if err != nil { return err diff --git a/services/storage-users/pkg/config/config.go b/services/storage-users/pkg/config/config.go index f6327df02..104780a2e 100644 --- a/services/storage-users/pkg/config/config.go +++ b/services/storage-users/pkg/config/config.go @@ -9,10 +9,10 @@ import ( // Config is the configuration for the storage-users service type Config struct { - Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service - Service Service `yaml:"-"` - Log *Log `yaml:"log"` - Debug Debug `yaml:"debug"` + Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service + Service Service `yaml:"-"` + LogLevel string `yaml:"loglevel" env:"OC_LOG_LEVEL;STORAGE_USERS_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + Debug Debug `yaml:"debug"` GRPC GRPCConfig `yaml:"grpc"` HTTP HTTPConfig `yaml:"http"` @@ -47,14 +47,6 @@ type Config struct { Context context.Context `yaml:"-"` } -// Log configures the logging -type Log struct { - Level string `yaml:"level" env:"OC_LOG_LEVEL;STORAGE_USERS_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` - Pretty bool `yaml:"pretty" env:"OC_LOG_PRETTY;STORAGE_USERS_LOG_PRETTY" desc:"Activates pretty log output." introductionVersion:"1.0.0"` - Color bool `yaml:"color" env:"OC_LOG_COLOR;STORAGE_USERS_LOG_COLOR" desc:"Activates colorized log output." introductionVersion:"1.0.0"` - File string `yaml:"file" env:"OC_LOG_FILE;STORAGE_USERS_LOG_FILE" desc:"The path to the log file. Activates logging to this file if set." introductionVersion:"1.0.0"` -} - // Service holds general service configuration type Service struct { Name string `yaml:"-" env:"STORAGE_USERS_SERVICE_NAME" desc:"Service name to use. Change this when starting an additional storage provider with a custom configuration to prevent it from colliding with the default 'storage-users' service." introductionVersion:"1.0.0"` diff --git a/services/storage-users/pkg/config/defaults/defaultconfig.go b/services/storage-users/pkg/config/defaults/defaultconfig.go index 1a94c8d43..fe7e17c9b 100644 --- a/services/storage-users/pkg/config/defaults/defaultconfig.go +++ b/services/storage-users/pkg/config/defaults/defaultconfig.go @@ -184,16 +184,8 @@ func DefaultConfig() *config.Config { // EnsureDefaults adds default values to the configuration if they are not set yet func EnsureDefaults(cfg *config.Config) { - // provide with defaults for shared logging, since we need a valid destination address for "envdecode". - 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" } if cfg.Reva == nil && cfg.Commons != nil { diff --git a/services/storage-users/pkg/logging/logging.go b/services/storage-users/pkg/logging/logging.go deleted file mode 100644 index 5f8089772..000000000 --- a/services/storage-users/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/storage-users/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), - ) -} From 30c4fb2b510246700f87c34a7258643e4450625f Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Thu, 8 Jan 2026 13:38:14 +0100 Subject: [PATCH 37/45] consolidate log config in thumbnails Signed-off-by: Christian Richter --- services/thumbnails/pkg/command/health.go | 4 ++-- services/thumbnails/pkg/command/server.go | 4 ++-- services/thumbnails/pkg/config/config.go | 4 ++-- .../pkg/config/defaults/defaultconfig.go | 12 ++---------- services/thumbnails/pkg/config/log.go | 9 --------- services/thumbnails/pkg/logging/logging.go | 17 ----------------- 6 files changed, 8 insertions(+), 42 deletions(-) delete mode 100644 services/thumbnails/pkg/config/log.go delete mode 100644 services/thumbnails/pkg/logging/logging.go diff --git a/services/thumbnails/pkg/command/health.go b/services/thumbnails/pkg/command/health.go index 831931379..3a93c4746 100644 --- a/services/thumbnails/pkg/command/health.go +++ b/services/thumbnails/pkg/command/health.go @@ -5,9 +5,9 @@ import ( "net/http" "github.com/opencloud-eu/opencloud/pkg/config/configlog" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/services/thumbnails/pkg/config" "github.com/opencloud-eu/opencloud/services/thumbnails/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/thumbnails/pkg/logging" "github.com/spf13/cobra" ) @@ -21,7 +21,7 @@ func Health(cfg *config.Config) *cobra.Command { return configlog.ReturnError(parser.ParseConfig(cfg)) }, 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) resp, err := http.Get( fmt.Sprintf( diff --git a/services/thumbnails/pkg/command/server.go b/services/thumbnails/pkg/command/server.go index 1f9988428..e9a0183f5 100644 --- a/services/thumbnails/pkg/command/server.go +++ b/services/thumbnails/pkg/command/server.go @@ -6,13 +6,13 @@ import ( "os/signal" "github.com/opencloud-eu/opencloud/pkg/config/configlog" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/pkg/runner" ogrpc "github.com/opencloud-eu/opencloud/pkg/service/grpc" "github.com/opencloud-eu/opencloud/pkg/tracing" "github.com/opencloud-eu/opencloud/pkg/version" "github.com/opencloud-eu/opencloud/services/thumbnails/pkg/config" "github.com/opencloud-eu/opencloud/services/thumbnails/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/thumbnails/pkg/logging" "github.com/opencloud-eu/opencloud/services/thumbnails/pkg/metrics" "github.com/opencloud-eu/opencloud/services/thumbnails/pkg/server/debug" "github.com/opencloud-eu/opencloud/services/thumbnails/pkg/server/grpc" @@ -30,7 +30,7 @@ func Server(cfg *config.Config) *cobra.Command { return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, 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) traceProvider, err := tracing.GetTraceProvider(cmd.Context(), cfg.Commons.TracesExporter, cfg.Service.Name) if err != nil { diff --git a/services/thumbnails/pkg/config/config.go b/services/thumbnails/pkg/config/config.go index cd2f407b9..408503b71 100644 --- a/services/thumbnails/pkg/config/config.go +++ b/services/thumbnails/pkg/config/config.go @@ -14,8 +14,8 @@ type Config struct { Service Service `yaml:"-"` - Log *Log `yaml:"log"` - Debug Debug `yaml:"debug"` + LogLevel string `yaml:"loglevel" env:"OC_LOG_LEVEL;THUMBNAILS_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + Debug Debug `yaml:"debug"` GRPC GRPCConfig `yaml:"grpc"` HTTP HTTP `yaml:"http"` diff --git a/services/thumbnails/pkg/config/defaults/defaultconfig.go b/services/thumbnails/pkg/config/defaults/defaultconfig.go index 949823d54..ede841213 100644 --- a/services/thumbnails/pkg/config/defaults/defaultconfig.go +++ b/services/thumbnails/pkg/config/defaults/defaultconfig.go @@ -64,16 +64,8 @@ func DefaultConfig() *config.Config { // EnsureDefaults adds default values to the configuration if they are not set yet func EnsureDefaults(cfg *config.Config) { - // provide with defaults for shared logging, since we need a valid destination address for "envdecode". - 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" } if cfg.GRPCClientTLS == nil && cfg.Commons != nil { diff --git a/services/thumbnails/pkg/config/log.go b/services/thumbnails/pkg/config/log.go deleted file mode 100644 index 4e3cea917..000000000 --- a/services/thumbnails/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;THUMBNAILS_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;THUMBNAILS_LOG_PRETTY" desc:"Activates pretty log output." introductionVersion:"1.0.0"` - Color bool `mapstructure:"color" env:"OC_LOG_COLOR;THUMBNAILS_LOG_COLOR" desc:"Activates colorized log output." introductionVersion:"1.0.0"` - File string `mapstructure:"file" env:"OC_LOG_FILE;THUMBNAILS_LOG_FILE" desc:"The path to the log file. Activates logging to this file if set." introductionVersion:"1.0.0"` -} diff --git a/services/thumbnails/pkg/logging/logging.go b/services/thumbnails/pkg/logging/logging.go deleted file mode 100644 index 942e50f0c..000000000 --- a/services/thumbnails/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/thumbnails/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), - ) -} From f69610777dd334ea58f026e55a3fb4d01659d515 Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Thu, 8 Jan 2026 13:41:10 +0100 Subject: [PATCH 38/45] consolidate log config in userlog Signed-off-by: Christian Richter --- services/userlog/pkg/command/server.go | 4 ++-- services/userlog/pkg/config/config.go | 4 ++-- .../pkg/config/defaults/defaultconfig.go | 12 ++---------- services/userlog/pkg/config/log.go | 9 --------- services/userlog/pkg/logging/logging.go | 17 ----------------- 5 files changed, 6 insertions(+), 40 deletions(-) delete mode 100644 services/userlog/pkg/config/log.go delete mode 100644 services/userlog/pkg/logging/logging.go diff --git a/services/userlog/pkg/command/server.go b/services/userlog/pkg/command/server.go index 3021fddc3..445bb6810 100644 --- a/services/userlog/pkg/command/server.go +++ b/services/userlog/pkg/command/server.go @@ -7,6 +7,7 @@ import ( "github.com/opencloud-eu/opencloud/pkg/config/configlog" "github.com/opencloud-eu/opencloud/pkg/generators" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/pkg/registry" "github.com/opencloud-eu/opencloud/pkg/runner" ogrpc "github.com/opencloud-eu/opencloud/pkg/service/grpc" @@ -16,7 +17,6 @@ import ( settingssvc "github.com/opencloud-eu/opencloud/protogen/gen/opencloud/services/settings/v0" "github.com/opencloud-eu/opencloud/services/userlog/pkg/config" "github.com/opencloud-eu/opencloud/services/userlog/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/userlog/pkg/logging" "github.com/opencloud-eu/opencloud/services/userlog/pkg/metrics" "github.com/opencloud-eu/opencloud/services/userlog/pkg/server/debug" "github.com/opencloud-eu/opencloud/services/userlog/pkg/server/http" @@ -56,7 +56,7 @@ func Server(cfg *config.Config) *cobra.Command { return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, 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) tracerProvider, err := tracing.GetTraceProvider(cmd.Context(), cfg.Commons.TracesExporter, cfg.Service.Name) if err != nil { return err diff --git a/services/userlog/pkg/config/config.go b/services/userlog/pkg/config/config.go index ac3ff1608..ff2d440e0 100644 --- a/services/userlog/pkg/config/config.go +++ b/services/userlog/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;USERLOG_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + Debug Debug `yaml:"debug"` HTTP HTTP `yaml:"http"` GRPCClientTLS *shared.GRPCClientTLS `yaml:"grpc_client_tls"` diff --git a/services/userlog/pkg/config/defaults/defaultconfig.go b/services/userlog/pkg/config/defaults/defaultconfig.go index 72e4a9af4..b8e40eea8 100644 --- a/services/userlog/pkg/config/defaults/defaultconfig.go +++ b/services/userlog/pkg/config/defaults/defaultconfig.go @@ -58,16 +58,8 @@ func DefaultConfig() *config.Config { // EnsureDefaults ensures the config contains default values func EnsureDefaults(cfg *config.Config) { - // provide with defaults for shared logging, since we need a valid destination address for "envdecode". - 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" } if cfg.GRPCClientTLS == nil && cfg.Commons != nil { diff --git a/services/userlog/pkg/config/log.go b/services/userlog/pkg/config/log.go deleted file mode 100644 index 1c37fcb7d..000000000 --- a/services/userlog/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;USERLOG_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;USERLOG_LOG_PRETTY" desc:"Activates pretty log output." introductionVersion:"1.0.0"` - Color bool `mapstructure:"color" env:"OC_LOG_COLOR;USERLOG_LOG_COLOR" desc:"Activates colorized log output." introductionVersion:"1.0.0"` - File string `mapstructure:"file" env:"OC_LOG_FILE;USERLOG_LOG_FILE" desc:"The path to the log file. Activates logging to this file if set." introductionVersion:"1.0.0"` -} diff --git a/services/userlog/pkg/logging/logging.go b/services/userlog/pkg/logging/logging.go deleted file mode 100644 index cdebe12dd..000000000 --- a/services/userlog/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/userlog/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), - ) -} From dd34f40618eac192217fd3bcdde66630af45d954 Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Thu, 8 Jan 2026 13:42:54 +0100 Subject: [PATCH 39/45] consolidate log config in users Signed-off-by: Christian Richter --- services/users/pkg/command/health.go | 4 ++-- services/users/pkg/command/server.go | 4 ++-- services/users/pkg/config/config.go | 14 ++++---------- .../users/pkg/config/defaults/defaultconfig.go | 12 ++---------- services/users/pkg/logging/logging.go | 17 ----------------- 5 files changed, 10 insertions(+), 41 deletions(-) delete mode 100644 services/users/pkg/logging/logging.go diff --git a/services/users/pkg/command/health.go b/services/users/pkg/command/health.go index 6f4893b9f..b1a3762e7 100644 --- a/services/users/pkg/command/health.go +++ b/services/users/pkg/command/health.go @@ -5,9 +5,9 @@ import ( "net/http" "github.com/opencloud-eu/opencloud/pkg/config/configlog" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/services/users/pkg/config" "github.com/opencloud-eu/opencloud/services/users/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/users/pkg/logging" "github.com/spf13/cobra" ) @@ -21,7 +21,7 @@ func Health(cfg *config.Config) *cobra.Command { return configlog.ReturnError(parser.ParseConfig(cfg)) }, 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) resp, err := http.Get( fmt.Sprintf( diff --git a/services/users/pkg/command/server.go b/services/users/pkg/command/server.go index 3f6bc2ae3..a73b977d0 100644 --- a/services/users/pkg/command/server.go +++ b/services/users/pkg/command/server.go @@ -7,13 +7,13 @@ import ( "github.com/opencloud-eu/opencloud/pkg/config/configlog" "github.com/opencloud-eu/opencloud/pkg/ldap" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/pkg/registry" "github.com/opencloud-eu/opencloud/pkg/runner" "github.com/opencloud-eu/opencloud/pkg/tracing" "github.com/opencloud-eu/opencloud/pkg/version" "github.com/opencloud-eu/opencloud/services/users/pkg/config" "github.com/opencloud-eu/opencloud/services/users/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/users/pkg/logging" "github.com/opencloud-eu/opencloud/services/users/pkg/revaconfig" "github.com/opencloud-eu/opencloud/services/users/pkg/server/debug" "github.com/opencloud-eu/reva/v2/cmd/revad/runtime" @@ -30,7 +30,7 @@ func Server(cfg *config.Config) *cobra.Command { return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, 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) traceProvider, err := tracing.GetTraceProvider(cmd.Context(), cfg.Commons.TracesExporter, cfg.Service.Name) if err != nil { return err diff --git a/services/users/pkg/config/config.go b/services/users/pkg/config/config.go index 57c7783d8..f9b667c8c 100644 --- a/services/users/pkg/config/config.go +++ b/services/users/pkg/config/config.go @@ -7,10 +7,10 @@ import ( ) type Config struct { - Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service - Service Service `yaml:"-"` - Log *Log `yaml:"log"` - Debug Debug `yaml:"debug"` + Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service + Service Service `yaml:"-"` + LogLevel string `yaml:"loglevel" env:"OC_LOG_LEVEL;USERS_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + Debug Debug `yaml:"debug"` GRPC GRPCConfig `yaml:"grpc"` @@ -24,12 +24,6 @@ type Config struct { Context context.Context `yaml:"-"` } -type Log struct { - Level string `yaml:"level" env:"OC_LOG_LEVEL;USERS_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` - Pretty bool `yaml:"pretty" env:"OC_LOG_PRETTY;USERS_LOG_PRETTY" desc:"Activates pretty log output." introductionVersion:"1.0.0"` - Color bool `yaml:"color" env:"OC_LOG_COLOR;USERS_LOG_COLOR" desc:"Activates colorized log output." introductionVersion:"1.0.0"` - File string `yaml:"file" env:"OC_LOG_FILE;USERS_LOG_FILE" desc:"The path to the log file. Activates logging to this file if set." introductionVersion:"1.0.0"` -} type Service struct { Name string `yaml:"-"` diff --git a/services/users/pkg/config/defaults/defaultconfig.go b/services/users/pkg/config/defaults/defaultconfig.go index bed8a152b..a604080de 100644 --- a/services/users/pkg/config/defaults/defaultconfig.go +++ b/services/users/pkg/config/defaults/defaultconfig.go @@ -89,16 +89,8 @@ func DefaultConfig() *config.Config { // EnsureDefaults adds default values to the configuration if they are not set yet func EnsureDefaults(cfg *config.Config) { - // provide with defaults for shared logging, since we need a valid destination address for "envdecode". - 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" } if cfg.Reva == nil && cfg.Commons != nil { diff --git a/services/users/pkg/logging/logging.go b/services/users/pkg/logging/logging.go deleted file mode 100644 index aaa6faa2e..000000000 --- a/services/users/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/users/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), - ) -} From f039bcf9952fd1131ec98c6b13cedff94c2849f5 Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Thu, 8 Jan 2026 13:44:41 +0100 Subject: [PATCH 40/45] consolidate log config in web Signed-off-by: Christian Richter --- services/web/pkg/command/health.go | 4 ++-- services/web/pkg/command/server.go | 4 ++-- services/web/pkg/config/config.go | 4 ++-- .../web/pkg/config/defaults/defaultconfig.go | 12 ++---------- services/web/pkg/config/log.go | 9 --------- services/web/pkg/logging/logging.go | 17 ----------------- 6 files changed, 8 insertions(+), 42 deletions(-) delete mode 100644 services/web/pkg/config/log.go delete mode 100644 services/web/pkg/logging/logging.go diff --git a/services/web/pkg/command/health.go b/services/web/pkg/command/health.go index c2b951e69..cf831c16f 100644 --- a/services/web/pkg/command/health.go +++ b/services/web/pkg/command/health.go @@ -5,9 +5,9 @@ import ( "net/http" "github.com/opencloud-eu/opencloud/pkg/config/configlog" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/services/web/pkg/config" "github.com/opencloud-eu/opencloud/services/web/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/web/pkg/logging" "github.com/spf13/cobra" ) @@ -21,7 +21,7 @@ func Health(cfg *config.Config) *cobra.Command { return configlog.ReturnError(parser.ParseConfig(cfg)) }, 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) resp, err := http.Get( fmt.Sprintf( diff --git a/services/web/pkg/command/server.go b/services/web/pkg/command/server.go index e8f0f2067..38df9caec 100644 --- a/services/web/pkg/command/server.go +++ b/services/web/pkg/command/server.go @@ -8,11 +8,11 @@ import ( "os/signal" "github.com/opencloud-eu/opencloud/pkg/config/configlog" + "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/web/pkg/config" "github.com/opencloud-eu/opencloud/services/web/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/web/pkg/logging" "github.com/opencloud-eu/opencloud/services/web/pkg/metrics" "github.com/opencloud-eu/opencloud/services/web/pkg/server/debug" "github.com/opencloud-eu/opencloud/services/web/pkg/server/http" @@ -29,7 +29,7 @@ func Server(cfg *config.Config) *cobra.Command { return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, 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) traceProvider, err := tracing.GetTraceProvider(cmd.Context(), cfg.Commons.TracesExporter, cfg.Service.Name) if err != nil { return err diff --git a/services/web/pkg/config/config.go b/services/web/pkg/config/config.go index c304c6d3c..e2edcab53 100644 --- a/services/web/pkg/config/config.go +++ b/services/web/pkg/config/config.go @@ -12,8 +12,8 @@ type Config struct { Service Service `yaml:"-"` - Log *Log `yaml:"log"` - Debug Debug `yaml:"debug"` + LogLevel string `yaml:"loglevel" env:"OC_LOG_LEVEL;WEB_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + Debug Debug `yaml:"debug"` HTTP HTTP `yaml:"http"` diff --git a/services/web/pkg/config/defaults/defaultconfig.go b/services/web/pkg/config/defaults/defaultconfig.go index 6286414ce..138daac77 100644 --- a/services/web/pkg/config/defaults/defaultconfig.go +++ b/services/web/pkg/config/defaults/defaultconfig.go @@ -119,16 +119,8 @@ func DefaultConfig() *config.Config { // EnsureDefaults adds default values to the configuration if they are not set yet func EnsureDefaults(cfg *config.Config) { - // provide with defaults for shared logging, since we need a valid destination address for "envdecode". - 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" } if cfg.TokenManager == nil && cfg.Commons != nil && cfg.Commons.TokenManager != nil { diff --git a/services/web/pkg/config/log.go b/services/web/pkg/config/log.go deleted file mode 100644 index 4b82fe236..000000000 --- a/services/web/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;WEB_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;WEB_LOG_PRETTY" desc:"Activates pretty log output." introductionVersion:"1.0.0"` - Color bool `mapstructure:"color" env:"OC_LOG_COLOR;WEB_LOG_COLOR" desc:"Activates colorized log output." introductionVersion:"1.0.0"` - File string `mapstructure:"file" env:"OC_LOG_FILE;WEB_LOG_FILE" desc:"The path to the log file. Activates logging to this file if set." introductionVersion:"1.0.0"` -} diff --git a/services/web/pkg/logging/logging.go b/services/web/pkg/logging/logging.go deleted file mode 100644 index 20ce81534..000000000 --- a/services/web/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/web/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), - ) -} From 36b90c86197153a9e6880d792f2134ddf4be774b Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Thu, 8 Jan 2026 13:46:30 +0100 Subject: [PATCH 41/45] consolidate log config in webdav Signed-off-by: Christian Richter --- services/webdav/pkg/command/health.go | 5 ++--- services/webdav/pkg/command/server.go | 5 ++--- services/webdav/pkg/config/config.go | 4 ++-- .../webdav/pkg/config/defaults/defaultconfig.go | 12 ++---------- services/webdav/pkg/config/log.go | 9 --------- services/webdav/pkg/logging/logging.go | 17 ----------------- 6 files changed, 8 insertions(+), 44 deletions(-) delete mode 100644 services/webdav/pkg/config/log.go delete mode 100644 services/webdav/pkg/logging/logging.go diff --git a/services/webdav/pkg/command/health.go b/services/webdav/pkg/command/health.go index ae8cd6859..51b27584e 100644 --- a/services/webdav/pkg/command/health.go +++ b/services/webdav/pkg/command/health.go @@ -5,10 +5,9 @@ import ( "net/http" "github.com/opencloud-eu/opencloud/pkg/config/configlog" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/services/webdav/pkg/config" "github.com/opencloud-eu/opencloud/services/webdav/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/webdav/pkg/logging" - "github.com/spf13/cobra" ) @@ -21,7 +20,7 @@ func Health(cfg *config.Config) *cobra.Command { return configlog.ReturnError(parser.ParseConfig(cfg)) }, 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) resp, err := http.Get( fmt.Sprintf( diff --git a/services/webdav/pkg/command/server.go b/services/webdav/pkg/command/server.go index b930695d4..846970629 100644 --- a/services/webdav/pkg/command/server.go +++ b/services/webdav/pkg/command/server.go @@ -6,17 +6,16 @@ import ( "os/signal" "github.com/opencloud-eu/opencloud/pkg/config/configlog" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/pkg/runner" ogrpc "github.com/opencloud-eu/opencloud/pkg/service/grpc" "github.com/opencloud-eu/opencloud/pkg/tracing" "github.com/opencloud-eu/opencloud/pkg/version" "github.com/opencloud-eu/opencloud/services/webdav/pkg/config" "github.com/opencloud-eu/opencloud/services/webdav/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/webdav/pkg/logging" "github.com/opencloud-eu/opencloud/services/webdav/pkg/metrics" "github.com/opencloud-eu/opencloud/services/webdav/pkg/server/debug" "github.com/opencloud-eu/opencloud/services/webdav/pkg/server/http" - "github.com/spf13/cobra" ) @@ -29,7 +28,7 @@ func Server(cfg *config.Config) *cobra.Command { return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, 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) traceProvider, err := tracing.GetTraceProvider(cmd.Context(), cfg.Commons.TracesExporter, cfg.Service.Name) if err != nil { return err diff --git a/services/webdav/pkg/config/config.go b/services/webdav/pkg/config/config.go index 8c4c7be40..324704464 100644 --- a/services/webdav/pkg/config/config.go +++ b/services/webdav/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;WEBDAV_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + Debug Debug `yaml:"debug"` GRPCClientTLS *shared.GRPCClientTLS `yaml:"grpc_client_tls"` GrpcClient client.Client `yaml:"-"` diff --git a/services/webdav/pkg/config/defaults/defaultconfig.go b/services/webdav/pkg/config/defaults/defaultconfig.go index 38dec1400..7bf35b7b0 100644 --- a/services/webdav/pkg/config/defaults/defaultconfig.go +++ b/services/webdav/pkg/config/defaults/defaultconfig.go @@ -47,16 +47,8 @@ func DefaultConfig() *config.Config { // EnsureDefaults adds default values to the configuration if they are not set yet func EnsureDefaults(cfg *config.Config) { - // provide with defaults for shared logging, since we need a valid destination address for "envdecode". - 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" } if cfg.GRPCClientTLS == nil && cfg.Commons != nil { diff --git a/services/webdav/pkg/config/log.go b/services/webdav/pkg/config/log.go deleted file mode 100644 index 22e9f08ad..000000000 --- a/services/webdav/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;WEBDAV_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;WEBDAV_LOG_PRETTY" desc:"Activates pretty log output." introductionVersion:"1.0.0"` - Color bool `mapstructure:"color" env:"OC_LOG_COLOR;WEBDAV_LOG_COLOR" desc:"Activates colorized log output." introductionVersion:"1.0.0"` - File string `mapstructure:"file" env:"OC_LOG_FILE;WEBDAV_LOG_FILE" desc:"The path to the log file. Activates logging to this file if set." introductionVersion:"1.0.0"` -} diff --git a/services/webdav/pkg/logging/logging.go b/services/webdav/pkg/logging/logging.go deleted file mode 100644 index 6b06e3b0b..000000000 --- a/services/webdav/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/webdav/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), - ) -} From 25952fc27c308b3c093a066f9ff833142482b3bc Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Thu, 8 Jan 2026 13:48:15 +0100 Subject: [PATCH 42/45] consolidate log config in webfinger Signed-off-by: Christian Richter --- services/webfinger/pkg/command/health.go | 4 ++-- services/webfinger/pkg/command/server.go | 4 ++-- services/webfinger/pkg/config/config.go | 4 ++-- .../pkg/config/defaults/defaultconfig.go | 12 ++---------- services/webfinger/pkg/config/log.go | 9 --------- services/webfinger/pkg/logging/logging.go | 17 ----------------- 6 files changed, 8 insertions(+), 42 deletions(-) delete mode 100644 services/webfinger/pkg/config/log.go delete mode 100644 services/webfinger/pkg/logging/logging.go diff --git a/services/webfinger/pkg/command/health.go b/services/webfinger/pkg/command/health.go index df5be2a71..16bcf1b71 100644 --- a/services/webfinger/pkg/command/health.go +++ b/services/webfinger/pkg/command/health.go @@ -5,9 +5,9 @@ import ( "net/http" "github.com/opencloud-eu/opencloud/pkg/config/configlog" + "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/services/webfinger/pkg/config" "github.com/opencloud-eu/opencloud/services/webfinger/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/webfinger/pkg/logging" "github.com/spf13/cobra" ) @@ -21,7 +21,7 @@ func Health(cfg *config.Config) *cobra.Command { return configlog.ReturnError(parser.ParseConfig(cfg)) }, 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) resp, err := http.Get( fmt.Sprintf( diff --git a/services/webfinger/pkg/command/server.go b/services/webfinger/pkg/command/server.go index fb93d0868..74c8fa688 100644 --- a/services/webfinger/pkg/command/server.go +++ b/services/webfinger/pkg/command/server.go @@ -6,12 +6,12 @@ import ( "os/signal" "github.com/opencloud-eu/opencloud/pkg/config/configlog" + "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/pkg/version" "github.com/opencloud-eu/opencloud/services/webfinger/pkg/config" "github.com/opencloud-eu/opencloud/services/webfinger/pkg/config/parser" - "github.com/opencloud-eu/opencloud/services/webfinger/pkg/logging" "github.com/opencloud-eu/opencloud/services/webfinger/pkg/metrics" "github.com/opencloud-eu/opencloud/services/webfinger/pkg/relations" "github.com/opencloud-eu/opencloud/services/webfinger/pkg/server/debug" @@ -30,7 +30,7 @@ func Server(cfg *config.Config) *cobra.Command { return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, 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) traceProvider, err := tracing.GetTraceProvider(cmd.Context(), cfg.Commons.TracesExporter, cfg.Service.Name) if err != nil { return err diff --git a/services/webfinger/pkg/config/config.go b/services/webfinger/pkg/config/config.go index 7055a97ee..dc3518aa2 100644 --- a/services/webfinger/pkg/config/config.go +++ b/services/webfinger/pkg/config/config.go @@ -12,8 +12,8 @@ type Config struct { Service Service `yaml:"-"` - Log *Log `yaml:"log"` - Debug Debug `yaml:"debug"` + LogLevel string `yaml:"loglevel" env:"OC_LOG_LEVEL;WEBFINGER_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + Debug Debug `yaml:"debug"` HTTP HTTP `yaml:"http"` diff --git a/services/webfinger/pkg/config/defaults/defaultconfig.go b/services/webfinger/pkg/config/defaults/defaultconfig.go index 3d698ce7f..bea1905a7 100644 --- a/services/webfinger/pkg/config/defaults/defaultconfig.go +++ b/services/webfinger/pkg/config/defaults/defaultconfig.go @@ -56,16 +56,8 @@ func DefaultConfig() *config.Config { // EnsureDefaults adds default values to the configuration if they are not set yet func EnsureDefaults(cfg *config.Config) { - // provide with defaults for shared logging, since we need a valid destination address for "envdecode". - 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" } if cfg.Commons != nil { diff --git a/services/webfinger/pkg/config/log.go b/services/webfinger/pkg/config/log.go deleted file mode 100644 index 45b137dec..000000000 --- a/services/webfinger/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;WEBFINGER_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;WEBFINGER_LOG_PRETTY" desc:"Activates pretty log output." introductionVersion:"1.0.0"` - Color bool `mapstructure:"color" env:"OC_LOG_COLOR;WEBFINGER_LOG_COLOR" desc:"Activates colorized log output." introductionVersion:"1.0.0"` - File string `mapstructure:"file" env:"OC_LOG_FILE;WEBFINGER_LOG_FILE" desc:"The path to the log file. Activates logging to this file if set." introductionVersion:"1.0.0"` -} diff --git a/services/webfinger/pkg/logging/logging.go b/services/webfinger/pkg/logging/logging.go deleted file mode 100644 index 98756b62d..000000000 --- a/services/webfinger/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/webfinger/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), - ) -} From cb9815acb14f7618651970f88681d1f7c6e87a24 Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Thu, 8 Jan 2026 14:16:31 +0100 Subject: [PATCH 43/45] fix yaml mappings Signed-off-by: Christian Richter --- pkg/shared/shared_types.go | 2 +- services/activitylog/pkg/config/config.go | 2 +- services/antivirus/pkg/config/config.go | 5 ++--- services/app-provider/pkg/config/config.go | 2 +- services/app-registry/pkg/config/config.go | 2 +- services/audit/pkg/config/config.go | 2 +- services/auth-app/pkg/config/config.go | 2 +- services/auth-basic/pkg/config/config.go | 2 +- services/auth-bearer/pkg/config/config.go | 2 +- services/auth-machine/pkg/config/config.go | 2 +- services/auth-service/pkg/config/config.go | 2 +- services/clientlog/pkg/config/config.go | 2 +- services/collaboration/pkg/config/config.go | 2 +- services/eventhistory/pkg/config/config.go | 2 +- services/frontend/pkg/config/config.go | 2 +- services/gateway/pkg/config/config.go | 2 +- services/graph/pkg/config/config.go | 2 +- services/groups/pkg/config/config.go | 2 +- services/idm/pkg/config/config.go | 2 +- services/idp/pkg/config/config.go | 2 +- services/invitations/pkg/config/config.go | 2 +- services/nats/pkg/config/config.go | 2 +- services/notifications/pkg/config/config.go | 2 +- services/sharing/pkg/config/config.go | 2 +- 24 files changed, 25 insertions(+), 26 deletions(-) diff --git a/pkg/shared/shared_types.go b/pkg/shared/shared_types.go index 125f9d78f..bac1a5098 100644 --- a/pkg/shared/shared_types.go +++ b/pkg/shared/shared_types.go @@ -12,7 +12,7 @@ type EnvBinding struct { // Log defines the available logging configuration. type Log struct { - Level string `yaml:"level" env:"OC_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + Level string `yaml:"loglevel" env:"OC_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` Pretty bool `yaml:"pretty" env:"OC_LOG_PRETTY" desc:"Activates pretty log output." introductionVersion:"1.0.0"` Color bool `yaml:"color" env:"OC_LOG_COLOR" desc:"Activates colorized log output." introductionVersion:"1.0.0"` File string `yaml:"file" env:"OC_LOG_FILE" desc:"The path to the log file. Activates logging to this file if set." introductionVersion:"1.0.0"` diff --git a/services/activitylog/pkg/config/config.go b/services/activitylog/pkg/config/config.go index 6497b1d90..3e904571c 100644 --- a/services/activitylog/pkg/config/config.go +++ b/services/activitylog/pkg/config/config.go @@ -13,7 +13,7 @@ type Config struct { Service Service `yaml:"-"` - LogLevel string `mapstructure:"loglevel" env:"OC_LOG_LEVEL;ACTIVITYLOG_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + LogLevel string `yaml:"loglevel" env:"OC_LOG_LEVEL;ACTIVITYLOG_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` Debug Debug `yaml:"debug"` diff --git a/services/antivirus/pkg/config/config.go b/services/antivirus/pkg/config/config.go index 5e7266b5d..32f89eb0b 100644 --- a/services/antivirus/pkg/config/config.go +++ b/services/antivirus/pkg/config/config.go @@ -31,9 +31,8 @@ const ( type Config struct { Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service File string - LogLevel string `mapstructure:"level" env:"OC_LOG_LEVEL;ANTIVIRUS_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` - - Debug Debug `yaml:"debug" mask:"struct"` + LogLevel string `yaml:"loglevel" env:"OC_LOG_LEVEL;ANTIVIRUS_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + Debug Debug `yaml:"debug" mask:"struct"` Service Service `yaml:"-"` diff --git a/services/app-provider/pkg/config/config.go b/services/app-provider/pkg/config/config.go index bcf35f7e1..e638a2678 100644 --- a/services/app-provider/pkg/config/config.go +++ b/services/app-provider/pkg/config/config.go @@ -9,7 +9,7 @@ import ( type Config struct { Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service Service Service `yaml:"-"` - LogLevel string `yaml:"level" env:"OC_LOG_LEVEL;APP_PROVIDER_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + LogLevel string `yaml:"loglevel" env:"OC_LOG_LEVEL;APP_PROVIDER_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` Debug Debug `yaml:"debug"` GRPC GRPCConfig `yaml:"grpc"` diff --git a/services/app-registry/pkg/config/config.go b/services/app-registry/pkg/config/config.go index 3aeb1ce3a..38d853dfa 100644 --- a/services/app-registry/pkg/config/config.go +++ b/services/app-registry/pkg/config/config.go @@ -10,7 +10,7 @@ type Config struct { Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service Service Service `yaml:"-"` - LogLevel string `yaml:"level" env:"OC_LOG_LEVEL;APP_REGISTRY_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + LogLevel string `yaml:"loglevel" env:"OC_LOG_LEVEL;APP_REGISTRY_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` Debug Debug `yaml:"debug"` diff --git a/services/audit/pkg/config/config.go b/services/audit/pkg/config/config.go index 37c5f9b6c..a37826b44 100644 --- a/services/audit/pkg/config/config.go +++ b/services/audit/pkg/config/config.go @@ -10,7 +10,7 @@ import ( type Config struct { Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service Service Service `yaml:"-"` - LogLevel string `yaml:"level" env:"OC_LOG_LEVEL;AUDIT_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + LogLevel string `yaml:"loglevel" env:"OC_LOG_LEVEL;AUDIT_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` Debug Debug `yaml:"debug"` Events Events `yaml:"events"` diff --git a/services/auth-app/pkg/config/config.go b/services/auth-app/pkg/config/config.go index 9cda13a36..5435ba83a 100644 --- a/services/auth-app/pkg/config/config.go +++ b/services/auth-app/pkg/config/config.go @@ -10,7 +10,7 @@ import ( type Config struct { Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service Service Service `yaml:"-"` - LogLevel string `yaml:"level" env:"OC_LOG_LEVEL;AUTH_APP_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + LogLevel string `yaml:"loglevel" env:"OC_LOG_LEVEL;AUTH_APP_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` Debug Debug `yaml:"debug"` GRPC GRPCConfig `yaml:"grpc"` diff --git a/services/auth-basic/pkg/config/config.go b/services/auth-basic/pkg/config/config.go index 45b75d50a..933a46bfd 100644 --- a/services/auth-basic/pkg/config/config.go +++ b/services/auth-basic/pkg/config/config.go @@ -9,7 +9,7 @@ import ( type Config struct { Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service Service Service `yaml:"-"` - LogLevel string `yaml:"level" env:"OC_LOG_LEVEL;AUTH_BASIC_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + LogLevel string `yaml:"loglevel" env:"OC_LOG_LEVEL;AUTH_BASIC_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` Debug Debug `yaml:"debug"` GRPC GRPCConfig `yaml:"grpc"` diff --git a/services/auth-bearer/pkg/config/config.go b/services/auth-bearer/pkg/config/config.go index 6eaa972f5..221a8b577 100644 --- a/services/auth-bearer/pkg/config/config.go +++ b/services/auth-bearer/pkg/config/config.go @@ -9,7 +9,7 @@ import ( type Config struct { Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service Service Service `yaml:"-"` - LogLevel string `yaml:"level" env:"OC_LOG_LEVEL;AUTH_BEARER_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + LogLevel string `yaml:"loglevel" env:"OC_LOG_LEVEL;AUTH_BEARER_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` Debug Debug `yaml:"debug"` diff --git a/services/auth-machine/pkg/config/config.go b/services/auth-machine/pkg/config/config.go index 623dce58d..3ed32c0ab 100644 --- a/services/auth-machine/pkg/config/config.go +++ b/services/auth-machine/pkg/config/config.go @@ -9,7 +9,7 @@ import ( type Config struct { Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service Service Service `yaml:"-"` - LogLevel string `yaml:"level" env:"OC_LOG_LEVEL;AUTH_MACHINE_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + LogLevel string `yaml:"loglevel" env:"OC_LOG_LEVEL;AUTH_MACHINE_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` Debug Debug `yaml:"debug"` GRPC GRPCConfig `yaml:"grpc"` diff --git a/services/auth-service/pkg/config/config.go b/services/auth-service/pkg/config/config.go index c60c71064..638a78024 100644 --- a/services/auth-service/pkg/config/config.go +++ b/services/auth-service/pkg/config/config.go @@ -9,7 +9,7 @@ import ( type Config struct { Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service Service Service `yaml:"-"` - LogLevel string `yaml:"level" env:"OC_LOG_LEVEL;AUTH_SERVICE_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + LogLevel string `yaml:"loglevel" env:"OC_LOG_LEVEL;AUTH_SERVICE_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` Debug Debug `yaml:"debug"` GRPC GRPCConfig `yaml:"grpc"` diff --git a/services/clientlog/pkg/config/config.go b/services/clientlog/pkg/config/config.go index 29b5a08a3..5af294331 100644 --- a/services/clientlog/pkg/config/config.go +++ b/services/clientlog/pkg/config/config.go @@ -12,7 +12,7 @@ type Config struct { Service Service `yaml:"-"` - LogLevel string `mapstructure:"level" env:"OC_LOG_LEVEL;CLIENTLOG_USERLOG_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + LogLevel string `yaml:"loglevel" env:"OC_LOG_LEVEL;CLIENTLOG_USERLOG_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` Debug Debug `yaml:"debug"` diff --git a/services/collaboration/pkg/config/config.go b/services/collaboration/pkg/config/config.go index 93a1c5959..9b4594bd9 100644 --- a/services/collaboration/pkg/config/config.go +++ b/services/collaboration/pkg/config/config.go @@ -22,7 +22,7 @@ type Config struct { Wopi Wopi `yaml:"wopi"` CS3Api CS3Api `yaml:"cs3api"` - LogLevel string `yaml:"level" env:"OC_LOG_LEVEL;COLLABORATION_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + LogLevel string `yaml:"loglevel" env:"OC_LOG_LEVEL;COLLABORATION_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` Debug Debug `yaml:"debug"` Context context.Context `yaml:"-"` diff --git a/services/eventhistory/pkg/config/config.go b/services/eventhistory/pkg/config/config.go index 9512aa007..5b93e5f2e 100644 --- a/services/eventhistory/pkg/config/config.go +++ b/services/eventhistory/pkg/config/config.go @@ -14,7 +14,7 @@ type Config struct { Service Service `yaml:"-"` - LogLevel string `mapstructure:"level" env:"OC_LOG_LEVEL;EVENTHISTORY_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + LogLevel string `yaml:"loglevel" env:"OC_LOG_LEVEL;EVENTHISTORY_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` Debug Debug `yaml:"debug"` GRPC GRPCConfig `yaml:"grpc"` diff --git a/services/frontend/pkg/config/config.go b/services/frontend/pkg/config/config.go index 1b1b4cb49..73dc6a674 100644 --- a/services/frontend/pkg/config/config.go +++ b/services/frontend/pkg/config/config.go @@ -10,7 +10,7 @@ import ( type Config struct { Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service Service Service `yaml:"-"` - LogLevel string `yaml:"level" env:"OC_LOG_LEVEL;FRONTEND_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + LogLevel string `yaml:"loglevel" env:"OC_LOG_LEVEL;FRONTEND_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` Debug Debug `yaml:"debug"` HTTP HTTPConfig `yaml:"http"` diff --git a/services/gateway/pkg/config/config.go b/services/gateway/pkg/config/config.go index 810fb4d84..4e1ad995e 100644 --- a/services/gateway/pkg/config/config.go +++ b/services/gateway/pkg/config/config.go @@ -11,7 +11,7 @@ type Config struct { Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service Service Service `yaml:"-"` - LogLevel string `yaml:"level" env:"OC_LOG_LEVEL;GATEWAY_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + LogLevel string `yaml:"loglevel" env:"OC_LOG_LEVEL;GATEWAY_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` Debug Debug `yaml:"debug"` GRPC GRPCConfig `yaml:"grpc"` diff --git a/services/graph/pkg/config/config.go b/services/graph/pkg/config/config.go index a446883a0..51571c460 100644 --- a/services/graph/pkg/config/config.go +++ b/services/graph/pkg/config/config.go @@ -13,7 +13,7 @@ type Config struct { Service Service `yaml:"-"` - LogLevel string `mapstructure:"level" env:"OC_LOG_LEVEL;GRAPH_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + LogLevel string `yaml:"loglevel" env:"OC_LOG_LEVEL;GRAPH_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` Cache *Cache `yaml:"cache"` Debug Debug `yaml:"debug"` diff --git a/services/groups/pkg/config/config.go b/services/groups/pkg/config/config.go index dc1738fd5..47bf20e02 100644 --- a/services/groups/pkg/config/config.go +++ b/services/groups/pkg/config/config.go @@ -9,7 +9,7 @@ import ( type Config struct { Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service Service Service `yaml:"-"` - LogLevel string `yaml:"level" env:"OC_LOG_LEVEL;GROUPS_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + LogLevel string `yaml:"loglevel" env:"OC_LOG_LEVEL;GROUPS_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` Debug Debug `yaml:"debug"` GRPC GRPCConfig `yaml:"grpc"` diff --git a/services/idm/pkg/config/config.go b/services/idm/pkg/config/config.go index 6dd543835..13e61d768 100644 --- a/services/idm/pkg/config/config.go +++ b/services/idm/pkg/config/config.go @@ -12,7 +12,7 @@ type Config struct { Service Service `yaml:"-"` - LogLevel string `mapstructure:"level" env:"OC_LOG_LEVEL;IDM_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + LogLevel string `yaml:"loglevel" env:"OC_LOG_LEVEL;IDM_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` Debug Debug `yaml:"debug"` IDM Settings `yaml:"idm"` diff --git a/services/idp/pkg/config/config.go b/services/idp/pkg/config/config.go index 08658dadc..627bba64d 100644 --- a/services/idp/pkg/config/config.go +++ b/services/idp/pkg/config/config.go @@ -13,7 +13,7 @@ type Config struct { Service Service `yaml:"-"` - LogLevel string `yaml:"level" env:"OC_LOG_LEVEL;IDP_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + LogLevel string `yaml:"loglevel" env:"OC_LOG_LEVEL;IDP_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` Debug Debug `yaml:"debug"` HTTP HTTP `yaml:"http"` diff --git a/services/invitations/pkg/config/config.go b/services/invitations/pkg/config/config.go index f7a9eaac0..6cf9843d5 100644 --- a/services/invitations/pkg/config/config.go +++ b/services/invitations/pkg/config/config.go @@ -12,7 +12,7 @@ type Config struct { Service Service `yaml:"-"` - LogLevel string `mapstructure:"level" env:"OC_LOG_LEVEL;INVITATIONS_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + LogLevel string `yaml:"loglevel" env:"OC_LOG_LEVEL;INVITATIONS_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` Debug Debug `yaml:"debug"` HTTP HTTP `yaml:"http"` diff --git a/services/nats/pkg/config/config.go b/services/nats/pkg/config/config.go index 0cda2038b..214b09ab6 100644 --- a/services/nats/pkg/config/config.go +++ b/services/nats/pkg/config/config.go @@ -10,7 +10,7 @@ import ( type Config struct { Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service Service Service `yaml:"-"` - LogLevel string `mapstructure:"level" env:"OC_LOG_LEVEL;NATS_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + LogLevel string `yaml:"loglevel" env:"OC_LOG_LEVEL;NATS_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` Debug Debug `yaml:"debug"` Nats Nats `ociConfig:"nats"` diff --git a/services/notifications/pkg/config/config.go b/services/notifications/pkg/config/config.go index f6a6d4b89..5206eae5f 100644 --- a/services/notifications/pkg/config/config.go +++ b/services/notifications/pkg/config/config.go @@ -14,7 +14,7 @@ type Config struct { Service Service `yaml:"-"` - LogLevel string `yaml:"level" env:"OC_LOG_LEVEL;NOTIFICATIONS_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + LogLevel string `yaml:"loglevel" env:"OC_LOG_LEVEL;NOTIFICATIONS_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` Debug Debug `yaml:"debug"` WebUIURL string `yaml:"opencloud_url" env:"OC_URL;NOTIFICATIONS_WEB_UI_URL" desc:"The public facing URL of the OpenCloud Web UI, used e.g. when sending notification eMails" introductionVersion:"1.0.0"` diff --git a/services/sharing/pkg/config/config.go b/services/sharing/pkg/config/config.go index c7a231915..0ba4a330f 100644 --- a/services/sharing/pkg/config/config.go +++ b/services/sharing/pkg/config/config.go @@ -9,7 +9,7 @@ import ( type Config struct { Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service Service Service `yaml:"-"` - LogLevel string `yaml:"logevel" env:"OC_LOG_LEVEL;SHARING_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + LogLevel string `yaml:"loglevel" env:"OC_LOG_LEVEL;SHARING_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` Debug Debug `yaml:"debug"` GRPC GRPCConfig `yaml:"grpc"` From b51c4af8d9a5d8986ef20eaa0725a674f870e9a0 Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Thu, 8 Jan 2026 14:50:44 +0100 Subject: [PATCH 44/45] remove logger from proxytest Signed-off-by: Christian Richter --- services/proxy/pkg/proxy/proxy_integration_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/services/proxy/pkg/proxy/proxy_integration_test.go b/services/proxy/pkg/proxy/proxy_integration_test.go index ea32170e0..ace5543a5 100644 --- a/services/proxy/pkg/proxy/proxy_integration_test.go +++ b/services/proxy/pkg/proxy/proxy_integration_test.go @@ -221,7 +221,6 @@ func (tc *testCase) expectProxyTo(strURL string) testCase { func testConfig(policy []config.Policy) *config.Config { return &config.Config{ - Log: &config.Log{}, Debug: config.Debug{}, HTTP: config.HTTP{}, Policies: policy, From 0bada429d36617f25b8f057d12a763d45a5395c1 Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Thu, 8 Jan 2026 15:32:10 +0100 Subject: [PATCH 45/45] fix typo in shared_types Signed-off-by: Christian Richter --- pkg/shared/shared_types.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/shared/shared_types.go b/pkg/shared/shared_types.go index bac1a5098..125f9d78f 100644 --- a/pkg/shared/shared_types.go +++ b/pkg/shared/shared_types.go @@ -12,7 +12,7 @@ type EnvBinding struct { // Log defines the available logging configuration. type Log struct { - Level string `yaml:"loglevel" env:"OC_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` + Level string `yaml:"level" env:"OC_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'." introductionVersion:"1.0.0"` Pretty bool `yaml:"pretty" env:"OC_LOG_PRETTY" desc:"Activates pretty log output." introductionVersion:"1.0.0"` Color bool `yaml:"color" env:"OC_LOG_COLOR" desc:"Activates colorized log output." introductionVersion:"1.0.0"` File string `yaml:"file" env:"OC_LOG_FILE" desc:"The path to the log file. Activates logging to this file if set." introductionVersion:"1.0.0"`