Skip to content

Added log package #177

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cmd/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"text/tabwriter"

"github.com/opdev/opcap/internal/capability"
"github.com/opdev/opcap/internal/logger"
"github.com/opdev/opcap/internal/operator"

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

Expand All @@ -91,5 +94,6 @@ func init() {
flags.StringSliceVar(&checkflags.AuditPlan, "audit-plan", defaultAuditPlan, "audit plan is the ordered list of operator test functions to be called during a capability audit.")
flags.BoolVar(&checkflags.ListPackages, "list-packages", false, "list packages in the catalog")
flags.StringSliceVar(&checkflags.Packages, "packages", []string{}, "a list of package(s) which limits audits and/or other flag(s) output")
flags.StringVar(&checkflags.LogLevel, "log-level", "", "specifies the one of the log levels in order of decreasing verbosity: debug, error, info, warn")
flags.BoolVar(&checkflags.AllInstallModes, "all-installmodes", false, "when set, all install modes supported by an operator will be tested")
}
3 changes: 3 additions & 0 deletions cmd/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ type UploadCommandFlags struct {
SecretAccessKey string `json:"secretaccesskey"`
UseSSL string `json:"usessl"`
Trace string `json:"trace"`
LogLevel string `json:"loglevel"`
}

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

func uploadPreRunE(cmd *cobra.Command, args []string) error {
Expand Down
17 changes: 7 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.17
require github.com/spf13/cobra v1.4.0

require (
github.com/operator-framework/operator-registry v1.22.0 // indirect
github.com/operator-framework/operator-registry v1.19.5 // indirect
github.com/sirupsen/logrus v1.8.1 // indirect
google.golang.org/grpc v1.46.0 // indirect
sigs.k8s.io/controller-runtime v0.12.1
Expand All @@ -15,8 +15,8 @@ require (
github.com/gobuffalo/envy v1.10.1
github.com/minio/minio-go/v7 v7.0.27
github.com/openshift/client-go v0.0.0-20200326155132-2a6cd50aedd0
github.com/operator-framework/api v0.15.0
github.com/operator-framework/operator-lifecycle-manager v0.21.2
github.com/operator-framework/api v0.17.0
github.com/operator-framework/operator-lifecycle-manager v0.19.1
k8s.io/api v0.24.0
k8s.io/apimachinery v0.24.0
k8s.io/client-go v0.24.0
Expand All @@ -34,15 +34,15 @@ require (
github.com/rogpeppe/go-internal v1.8.0 // indirect
github.com/rs/xid v1.2.1 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/goleak v1.2.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
golang.org/x/crypto v0.0.0-20220214200702-86341886e292 // indirect
golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 // indirect
gopkg.in/ini.v1 v1.57.0 // indirect
)

require (
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20210826220005-b48c857c3a0e // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
Expand All @@ -57,7 +57,6 @@ require (
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/cel-go v0.10.1 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/go-cmp v0.5.6 // indirect
github.com/google/gofuzz v1.1.0 // indirect
Expand All @@ -80,8 +79,7 @@ require (
github.com/prometheus/common v0.32.1 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stoewer/go-strcase v1.2.0 // indirect
go.uber.org/zap v1.21.0
go.uber.org/zap v1.23.0
golang.org/x/net v0.0.0-20220225172249-27dd8689420f // indirect
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect
golang.org/x/sys v0.0.0-20220209214540-3681064d5158 // indirect
Expand All @@ -92,10 +90,9 @@ require (
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20220107163113-42d7afdf6368 // indirect
google.golang.org/protobuf v1.27.1 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiextensions-apiserver v0.24.0
k8s.io/component-base v0.24.0 // indirect
k8s.io/klog/v2 v2.60.1 // indirect
Expand Down
Loading