Skip to content

Commit 0b5c272

Browse files
committed
pkg/scaffold/*: use logrus instead of std log
1 parent b93a726 commit 0b5c272

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

pkg/scaffold/role.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ import (
1919
"errors"
2020
"fmt"
2121
"io/ioutil"
22-
"log"
2322
"path/filepath"
2423

2524
"github.com/operator-framework/operator-sdk/internal/util/fileutil"
2625
"github.com/operator-framework/operator-sdk/pkg/scaffold/input"
2726

27+
log "github.com/sirupsen/logrus"
2828
yaml "gopkg.in/yaml.v2"
2929
rbacv1 "k8s.io/api/rbac/v1"
3030
cgoscheme "k8s.io/client-go/kubernetes/scheme"
@@ -70,7 +70,7 @@ func UpdateRoleForResource(r *Resource, absProjectPath string) error {
7070
// check if the resource already exists
7171
for _, resource := range pr.Resources {
7272
if resource == r.Resource {
73-
log.Printf("deploy/role.yaml RBAC rules already up to date for the resource (%v, %v)", r.APIVersion, r.Kind)
73+
log.Infof("deploy/role.yaml RBAC rules already up to date for the resource (%v, %v)", r.APIVersion, r.Kind)
7474
return nil
7575
}
7676
}
@@ -112,7 +112,7 @@ func UpdateRoleForResource(r *Resource, absProjectPath string) error {
112112
// check if the resource already exists
113113
for _, resource := range pr.Resources {
114114
if resource == r.Resource {
115-
log.Printf("deploy/role.yaml RBAC rules already up to date for the resource (%v, %v)", r.APIVersion, r.Kind)
115+
log.Infof("deploy/role.yaml RBAC rules already up to date for the resource (%v, %v)", r.APIVersion, r.Kind)
116116
return nil
117117
}
118118
}

pkg/scaffold/scaffold.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,15 @@ import (
2020
"bytes"
2121
"fmt"
2222
"io"
23-
"log"
2423
"os"
2524
"path/filepath"
2625
"strings"
2726
"text/template"
2827

2928
"github.com/operator-framework/operator-sdk/internal/util/fileutil"
3029
"github.com/operator-framework/operator-sdk/pkg/scaffold/input"
30+
31+
log "github.com/sirupsen/logrus"
3132
"golang.org/x/tools/imports"
3233
)
3334

@@ -161,7 +162,7 @@ func (s *Scaffold) doTemplate(i input.Input, e input.File, absPath string) error
161162
}
162163

163164
_, err = f.Write(b)
164-
fmt.Printf("Create %s\n", i.Path)
165+
fmt.Println("Create", i.Path)
165166
return err
166167
}
167168

pkg/scaffold/test_setup.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@ package scaffold
1717
import (
1818
"bytes"
1919
"io"
20-
"log"
2120
"os"
2221
"path/filepath"
2322

2423
"github.com/operator-framework/operator-sdk/pkg/scaffold/input"
24+
25+
log "github.com/sirupsen/logrus"
2526
)
2627

2728
const (
@@ -43,7 +44,7 @@ var (
4344
func mustGetImportPath() string {
4445
wd, err := os.Getwd()
4546
if err != nil {
46-
log.Fatal("mustGetImportPath: ", err)
47+
log.Fatalf("mustGetImportPath: (%v)", err)
4748
}
4849
return filepath.Join(wd, appRepo)
4950
}

0 commit comments

Comments
 (0)