diff --git a/logging/init.go b/logging/init.go index b1e8ebd..a76af61 100644 --- a/logging/init.go +++ b/logging/init.go @@ -4,26 +4,18 @@ import ( "os" "time" - "github.com/getsentry/sentry-go" "github.com/rs/zerolog" "github.com/rs/zerolog/log" ) -var levelsMapping = map[zerolog.Level]sentry.Level{ - zerolog.DebugLevel: sentry.LevelDebug, - zerolog.InfoLevel: sentry.LevelInfo, - zerolog.WarnLevel: sentry.LevelWarning, - zerolog.ErrorLevel: sentry.LevelError, - zerolog.FatalLevel: sentry.LevelFatal, - zerolog.PanicLevel: sentry.LevelFatal, -} - // Initialize configures ZeroLog with defaults. -func Initialize() { - cw := zerolog.NewConsoleWriter() - cw.Out = os.Stderr - cw.TimeFormat = "15:04:05" - log.Logger = zerolog.New(cw).With().Timestamp().Logger() +func Initialize(console bool) { + if console { + cw := zerolog.NewConsoleWriter() + cw.Out = os.Stderr + cw.TimeFormat = "15:04:05" + log.Logger = zerolog.New(cw).With().Timestamp().Logger() + } zerolog.DurationFieldUnit = time.Millisecond }