fix sonar smells
This commit is contained in:
@@ -253,7 +253,7 @@ func trap(s *Service, halt chan os.Signal) {
|
||||
for sName := range s.serviceToken {
|
||||
for i := range s.serviceToken[sName] {
|
||||
if err := s.Supervisor.Remove(s.serviceToken[sName][i]); err != nil {
|
||||
// TODO(refs) deal with me
|
||||
s.Log.Error().Err(err).Str("service", "runtime service").Msgf("terminating with signal: %v", s)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -265,7 +265,7 @@ func trap(s *Service, halt chan os.Signal) {
|
||||
// want to expose to the end user the internal framework logs unless explicitly specified.
|
||||
func setMicroLogger() {
|
||||
if os.Getenv("MICRO_LOG_LEVEL") == "" {
|
||||
os.Setenv("MICRO_LOG_LEVEL", "error")
|
||||
_ = os.Setenv("MICRO_LOG_LEVEL", "error")
|
||||
}
|
||||
|
||||
lev, err := zerolog.ParseLevel(os.Getenv("MICRO_LOG_LEVEL"))
|
||||
|
||||
@@ -49,15 +49,9 @@ func New() *Metrics {
|
||||
}, []string{"versions"}),
|
||||
}
|
||||
|
||||
prometheus.Register(m.Counter)
|
||||
prometheus.Register(m.Latency)
|
||||
prometheus.Register(m.Duration)
|
||||
prometheus.Register(m.BuildInfo)
|
||||
_ = prometheus.Register(m.Counter)
|
||||
_ = prometheus.Register(m.Latency)
|
||||
_ = prometheus.Register(m.Duration)
|
||||
_ = prometheus.Register(m.BuildInfo)
|
||||
return m
|
||||
}
|
||||
|
||||
func mustNotFail(err error) {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
package command
|
||||
|
||||
// Option defines a single modifier to an Options attribute.
|
||||
type Option func(o *Options)
|
||||
|
||||
type Options struct {
|
||||
// LogPretty toggles pretty logging lines.
|
||||
LogPretty bool
|
||||
|
||||
// LogColor toggles colored output.
|
||||
LogColor bool
|
||||
|
||||
// LogLevel raises / decreases logging levels.
|
||||
LogLevel string
|
||||
}
|
||||
|
||||
// newOptions initializes the available default options.
|
||||
func newOptions(opts ...Option) Options {
|
||||
opt := Options{}
|
||||
|
||||
for _, o := range opts {
|
||||
o(&opt)
|
||||
}
|
||||
|
||||
return opt
|
||||
}
|
||||
|
||||
// WithLogPretty toggles pretty output for a storage logger.
|
||||
func WithLogPretty(v bool) Option {
|
||||
return func(o *Options) {
|
||||
o.LogPretty = v
|
||||
}
|
||||
}
|
||||
|
||||
// WithLogColor toggles colored output for a storage logger.
|
||||
func WithLogColor(v bool) Option {
|
||||
return func(o *Options) {
|
||||
o.LogColor = v
|
||||
}
|
||||
}
|
||||
|
||||
// WithLogLevel toggles colored output for a storage logger.
|
||||
func WithLogLevel(v string) Option {
|
||||
return func(o *Options) {
|
||||
o.LogLevel = v
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user