mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 09:28:54 +00:00
Log all errors regardless of log level (#496)
Modify the loggerDebug function to check whether the error is nil before choosing the log level. Fixes #473
This commit is contained in:
parent
5c69094571
commit
d827a9d6b7
1 changed files with 5 additions and 2 deletions
|
|
@ -1,9 +1,9 @@
|
|||
package service
|
||||
|
||||
import (
|
||||
"github.com/fleetdm/fleet/server/kolide"
|
||||
kitlog "github.com/go-kit/kit/log"
|
||||
"github.com/go-kit/kit/log/level"
|
||||
"github.com/fleetdm/fleet/server/kolide"
|
||||
)
|
||||
|
||||
// logging middleware logs the service actions
|
||||
|
|
@ -17,8 +17,11 @@ func NewLoggingService(svc kolide.Service, logger kitlog.Logger) kolide.Service
|
|||
return loggingMiddleware{Service: svc, logger: logger}
|
||||
}
|
||||
|
||||
// loggerDebug returns the debug level
|
||||
// loggerDebug returns the the info level if there error is non-nil, otherwise defaulting to the debug level.
|
||||
func (mw loggingMiddleware) loggerDebug(err error) kitlog.Logger {
|
||||
if err != nil {
|
||||
return level.Info(mw.logger)
|
||||
}
|
||||
return level.Debug(mw.logger)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue