refactor NewLogger away to ocis-pkg

This commit is contained in:
A.Unger
2021-11-08 19:38:40 +01:00
parent 9d0809bd81
commit e7f9fb3bcb
5 changed files with 20 additions and 18 deletions
+13
View File
@@ -6,6 +6,8 @@ import (
"strings"
"time"
"github.com/owncloud/ocis/ocis-pkg/shared"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
mdlog "go-micro.dev/v4/debug/log"
@@ -18,6 +20,17 @@ type Logger struct {
zerolog.Logger
}
// LoggerFromConfig initializes a service-specific logger instance.
func LoggerFromConfig(name string, cfg shared.Log) Logger {
return NewLogger(
Name(name),
Level(cfg.Level),
Pretty(cfg.Pretty),
Color(cfg.Color),
File(cfg.File),
)
}
// NewLogger initializes a new logger instance.
func NewLogger(opts ...Option) Logger {
options := newOptions(opts...)