mirror of
https://github.com/empayre/fleet.git
synced 2024-11-06 17:05:18 +00:00
df93abd722
* Moves much logging from the info level to the debug level * Tries to retain security/auditing relevant logs at info level
29 lines
751 B
Go
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)
|
|
}
|