move log configure function to global log package

Signed-off-by: Christian Richter <c.richter@opencloud.eu>
This commit is contained in:
Christian Richter
2026-01-08 12:25:44 +01:00
parent efd6331a61
commit 4883496527
3 changed files with 16 additions and 16 deletions
+14
View File
@@ -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),
)
}
-14
View File
@@ -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),
)
}
+2 -2
View File
@@ -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")