mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-04-29 15:29:52 -05:00
refactor NewLogger away to ocis-pkg
This commit is contained in:
@@ -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...)
|
||||
|
||||
Reference in New Issue
Block a user