Skip to content

Commit 83a55db

Browse files
Merge pull request #177 from yuriolisa/adding-logger
Added log package
2 parents 2942e4e + e002aa6 commit 83a55db

17 files changed

+893
-83
lines changed

cmd/check.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"text/tabwriter"
99

1010
"github.com/opdev/opcap/internal/capability"
11+
"github.com/opdev/opcap/internal/logger"
1112
"github.com/opdev/opcap/internal/operator"
1213

1314
pkgserverv1 "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/operators/v1"
@@ -25,6 +26,7 @@ advanced features by running custom resources provided by CSVs
2526
and/or users.`,
2627
Example: "opcap check --catalogsource=certified-operators --catalogsourcenamespace=openshift-marketplace",
2728
PreRunE: func(cmd *cobra.Command, args []string) error {
29+
logger.InitLogger(checkflags.LogLevel)
2830
psc, err := operator.NewOpCapClient()
2931
if err != nil {
3032
return types.Error{Msg: "Unable to create OpCap client."}
@@ -73,6 +75,7 @@ type CheckCommandFlags struct {
7375
CatalogSourceNamespace string `json:"catalogsourcenamespace"`
7476
ListPackages bool `json:"listPackages"`
7577
Packages []string `json:"packages"`
78+
LogLevel string `json:"loglevel"`
7679
AllInstallModes bool `json:"allInstallModes"`
7780
}
7881

@@ -91,5 +94,6 @@ func init() {
9194
flags.StringSliceVar(&checkflags.AuditPlan, "audit-plan", defaultAuditPlan, "audit plan is the ordered list of operator test functions to be called during a capability audit.")
9295
flags.BoolVar(&checkflags.ListPackages, "list-packages", false, "list packages in the catalog")
9396
flags.StringSliceVar(&checkflags.Packages, "packages", []string{}, "a list of package(s) which limits audits and/or other flag(s) output")
97+
flags.StringVar(&checkflags.LogLevel, "log-level", "", "specifies the one of the log levels in order of decreasing verbosity: debug, error, info, warn")
9498
flags.BoolVar(&checkflags.AllInstallModes, "all-installmodes", false, "when set, all install modes supported by an operator will be tested")
9599
}

cmd/upload.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ type UploadCommandFlags struct {
2727
SecretAccessKey string `json:"secretaccesskey"`
2828
UseSSL string `json:"usessl"`
2929
Trace string `json:"trace"`
30+
LogLevel string `json:"loglevel"`
3031
}
3132

3233
type Report struct {
@@ -80,6 +81,8 @@ func init() {
8081
"when used s3 backend is expected to be accessible via https; false by default")
8182
flags.StringVar(&uploadflags.Trace, "trace", envy.Get("TRACE", "false"),
8283
"enable tracing; false by default")
84+
flags.StringVar(&uploadflags.LogLevel, "log-level", "",
85+
"specifies the one of the log levels in order of decreasing verbosity: debug, error, info, warn")
8386
}
8487

8588
func uploadPreRunE(cmd *cobra.Command, args []string) error {

go.mod

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.17
55
require github.com/spf13/cobra v1.4.0
66

77
require (
8-
github.com/operator-framework/operator-registry v1.22.0 // indirect
8+
github.com/operator-framework/operator-registry v1.19.5 // indirect
99
github.com/sirupsen/logrus v1.8.1 // indirect
1010
google.golang.org/grpc v1.46.0 // indirect
1111
sigs.k8s.io/controller-runtime v0.12.1
@@ -15,8 +15,8 @@ require (
1515
github.com/gobuffalo/envy v1.10.1
1616
github.com/minio/minio-go/v7 v7.0.27
1717
github.com/openshift/client-go v0.0.0-20200326155132-2a6cd50aedd0
18-
github.com/operator-framework/api v0.15.0
19-
github.com/operator-framework/operator-lifecycle-manager v0.21.2
18+
github.com/operator-framework/api v0.17.0
19+
github.com/operator-framework/operator-lifecycle-manager v0.19.1
2020
k8s.io/api v0.24.0
2121
k8s.io/apimachinery v0.24.0
2222
k8s.io/client-go v0.24.0
@@ -34,15 +34,15 @@ require (
3434
github.com/rogpeppe/go-internal v1.8.0 // indirect
3535
github.com/rs/xid v1.2.1 // indirect
3636
go.uber.org/atomic v1.7.0 // indirect
37+
go.uber.org/goleak v1.2.0 // indirect
3738
go.uber.org/multierr v1.6.0 // indirect
38-
golang.org/x/crypto v0.0.0-20220214200702-86341886e292 // indirect
39+
golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 // indirect
3940
gopkg.in/ini.v1 v1.57.0 // indirect
4041
)
4142

4243
require (
4344
github.com/PuerkitoBio/purell v1.1.1 // indirect
4445
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
45-
github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20210826220005-b48c857c3a0e // indirect
4646
github.com/beorn7/perks v1.0.1 // indirect
4747
github.com/blang/semver/v4 v4.0.0 // indirect
4848
github.com/cespare/xxhash/v2 v2.1.2 // indirect
@@ -57,7 +57,6 @@ require (
5757
github.com/gogo/protobuf v1.3.2 // indirect
5858
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
5959
github.com/golang/protobuf v1.5.2 // indirect
60-
github.com/google/cel-go v0.10.1 // indirect
6160
github.com/google/gnostic v0.5.7-v3refs // indirect
6261
github.com/google/go-cmp v0.5.6 // indirect
6362
github.com/google/gofuzz v1.1.0 // indirect
@@ -80,8 +79,7 @@ require (
8079
github.com/prometheus/common v0.32.1 // indirect
8180
github.com/prometheus/procfs v0.7.3 // indirect
8281
github.com/spf13/pflag v1.0.5 // indirect
83-
github.com/stoewer/go-strcase v1.2.0 // indirect
84-
go.uber.org/zap v1.21.0
82+
go.uber.org/zap v1.23.0
8583
golang.org/x/net v0.0.0-20220225172249-27dd8689420f // indirect
8684
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect
8785
golang.org/x/sys v0.0.0-20220209214540-3681064d5158 // indirect
@@ -92,10 +90,9 @@ require (
9290
google.golang.org/appengine v1.6.7 // indirect
9391
google.golang.org/genproto v0.0.0-20220107163113-42d7afdf6368 // indirect
9492
google.golang.org/protobuf v1.27.1 // indirect
95-
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
9693
gopkg.in/inf.v0 v0.9.1 // indirect
9794
gopkg.in/yaml.v2 v2.4.0 // indirect
98-
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
95+
gopkg.in/yaml.v3 v3.0.1 // indirect
9996
k8s.io/apiextensions-apiserver v0.24.0
10097
k8s.io/component-base v0.24.0 // indirect
10198
k8s.io/klog/v2 v2.60.1 // indirect

0 commit comments

Comments
 (0)