fleet/server/service/logging.go
Charlie Gildawie df93abd722
Reduce verbosity of default logging (#2225)
* Moves much logging from the info level to the debug level
* Tries to retain security/auditing relevant logs at info level
2020-04-22 14:01:34 -07:00

29 lines
751 B
Go

package service
import (
kitlog "github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"
"github.com/kolide/fleet/server/kolide"
)
// logging middleware logs the service actions
type loggingMiddleware struct {
kolide.Service
logger kitlog.Logger
}
// NewLoggingService takes an existing service and adds a logging wrapper
func NewLoggingService(svc kolide.Service, logger kitlog.Logger) kolide.Service {
return loggingMiddleware{Service: svc, logger: logger}
}
// loggerDebug returns the debug level
func (mw loggingMiddleware) loggerDebug(err error) kitlog.Logger {
return level.Debug(mw.logger)
}
// loggerInfo returns the info level
func (mw loggingMiddleware) loggerInfo(err error) kitlog.Logger {
return level.Info(mw.logger)
}