1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-07 06:45:23 +02:00

feat(logging): replace all the loggers with zerolog EE-4186 (#7663)

This commit is contained in:
andres-portainer 2022-09-16 13:18:44 -03:00 committed by GitHub
parent 53025178ef
commit 36e7981ab7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
109 changed files with 1101 additions and 662 deletions

View file

@ -4,10 +4,10 @@ import (
"fmt"
"strings"
"github.com/portainer/portainer/api/dataservices/errors"
"github.com/sirupsen/logrus"
portainer "github.com/portainer/portainer/api"
"github.com/portainer/portainer/api/dataservices/errors"
"github.com/rs/zerolog/log"
)
const (
@ -60,13 +60,15 @@ func (service *Service) TeamByName(name string) (*portainer.Team, error) {
func(obj interface{}) (interface{}, error) {
team, ok := obj.(*portainer.Team)
if !ok {
logrus.WithField("obj", obj).Errorf("Failed to convert to Team object")
log.Debug().Str("obj", fmt.Sprintf("%#v", obj)).Msg("failed to convert to Team object")
return nil, fmt.Errorf("Failed to convert to Team object: %s", obj)
}
if strings.EqualFold(team.Name, name) {
t = team
return nil, stop
}
return &portainer.Team{}, nil
})
if err == stop {
@ -89,10 +91,12 @@ func (service *Service) Teams() ([]portainer.Team, error) {
func(obj interface{}) (interface{}, error) {
team, ok := obj.(*portainer.Team)
if !ok {
logrus.WithField("obj", obj).Errorf("Failed to convert to Team object")
log.Debug().Str("obj", fmt.Sprintf("%#v", obj)).Msg("failed to convert to Team object")
return nil, fmt.Errorf("Failed to convert to Team object: %s", obj)
}
teams = append(teams, *team)
return &portainer.Team{}, nil
})