rename logger pkg to logger

Signed-off-by: Meredith Lancaster <malancas@github.com>
This commit is contained in:
Meredith Lancaster 2024-03-04 15:36:48 -07:00
parent fa22214380
commit 4df1548c1e
12 changed files with 26 additions and 26 deletions

View file

@ -8,7 +8,7 @@ import (
"github.com/cli/cli/v2/pkg/cmdutil"
"github.com/cli/cli/v2/pkg/cmd/attestation/artifact"
"github.com/cli/cli/v2/pkg/cmd/attestation/api"
"github.com/cli/cli/v2/pkg/cmd/attestation/logger"
"github.com/cli/cli/v2/pkg/cmd/attestation/logging"
"github.com/MakeNowJust/heredoc"
"github.com/spf13/cobra"
@ -57,7 +57,7 @@ func NewDownloadCmd(f *cmdutil.Factory) *cobra.Command {
opts.APIClient = api.NewLiveClient()
// Create a logger for use throughout the download command
opts.Logger = logger.NewLogger(f.IOStreams, false, opts.Verbose)
opts.Logger = logging.NewLogger(f.IOStreams, false, opts.Verbose)
// Configure the live OCI client
opts.ConfigureOCIClient()

View file

@ -9,7 +9,7 @@ import (
"github.com/cli/cli/v2/pkg/cmd/attestation/api"
"github.com/cli/cli/v2/pkg/cmd/attestation/artifact"
"github.com/cli/cli/v2/pkg/cmd/attestation/artifact/oci"
"github.com/cli/cli/v2/pkg/cmd/attestation/logger"
"github.com/cli/cli/v2/pkg/cmd/attestation/logging"
"github.com/cli/cli/v2/pkg/cmd/attestation/test"
"github.com/stretchr/testify/assert"
@ -31,7 +31,7 @@ func TestRunDownload(t *testing.T) {
DigestAlgorithm: "sha512",
OutputPath: tempDir,
Limit: 30,
Logger: logger.NewSystemLogger(),
Logger: logging.NewSystemLogger(),
}
t.Run("fetch and store attestations successfully", func(t *testing.T) {

View file

@ -6,14 +6,14 @@ import (
"github.com/cli/cli/v2/pkg/cmd/attestation/api"
"github.com/cli/cli/v2/pkg/cmd/attestation/artifact/digest"
"github.com/cli/cli/v2/pkg/cmd/attestation/artifact/oci"
"github.com/cli/cli/v2/pkg/cmd/attestation/logger"
"github.com/cli/cli/v2/pkg/cmd/attestation/logging"
)
type Options struct {
ArtifactPath string
DigestAlgorithm string
APIClient api.Client
Logger *logger.Logger
Logger *logging.Logger
Limit int
OCIClient oci.Client
OutputPath string

View file

@ -7,7 +7,7 @@ import (
"github.com/cli/cli/v2/pkg/cmdutil"
"github.com/cli/cli/v2/pkg/cmd/attestation/artifact"
"github.com/cli/cli/v2/pkg/cmd/attestation/logger"
"github.com/cli/cli/v2/pkg/cmd/attestation/logging"
"github.com/cli/cli/v2/pkg/cmd/attestation/verification"
"github.com/MakeNowJust/heredoc"
@ -50,7 +50,7 @@ func NewInspectCmd(f *cmdutil.Factory) *cobra.Command {
`),
PreRunE: func(cmd *cobra.Command, args []string) error {
// Create a logger for use throughout the inspect command
opts.Logger = logger.NewDefaultLogger(f.IOStreams)
opts.Logger = logging.NewDefaultLogger(f.IOStreams)
// set the artifact path
opts.ArtifactPath = args[0]

View file

@ -3,7 +3,7 @@ package inspect
import (
"testing"
"github.com/cli/cli/v2/pkg/cmd/attestation/logger"
"github.com/cli/cli/v2/pkg/cmd/attestation/logging"
"github.com/cli/cli/v2/pkg/cmd/attestation/test"
"github.com/stretchr/testify/assert"
@ -23,7 +23,7 @@ func TestRunInspect(t *testing.T) {
res := test.SuppressAndRestoreOutput()
defer res()
logger := logger.NewSystemLogger()
logger := logging.NewSystemLogger()
opts := Options{
ArtifactPath: artifactPath,

View file

@ -6,7 +6,7 @@ import (
"github.com/cli/cli/v2/pkg/cmd/attestation/artifact/digest"
"github.com/cli/cli/v2/pkg/cmd/attestation/artifact/oci"
"github.com/cli/cli/v2/pkg/cmd/attestation/logger"
"github.com/cli/cli/v2/pkg/cmd/attestation/logging"
)
// Options captures the options for the inspect command
@ -16,7 +16,7 @@ type Options struct {
DigestAlgorithm string
JsonResult bool
Verbose bool
Logger *logger.Logger
Logger *logging.Logger
OCIClient oci.Client
}

View file

@ -1,4 +1,4 @@
package logger
package logging
import (
"fmt"

View file

@ -4,7 +4,7 @@ import (
"fmt"
"github.com/cli/cli/v2/pkg/cmd/attestation/api"
"github.com/cli/cli/v2/pkg/cmd/attestation/logger"
"github.com/cli/cli/v2/pkg/cmd/attestation/logging"
"github.com/sigstore/sigstore-go/pkg/bundle"
"github.com/sigstore/sigstore-go/pkg/root"
@ -30,7 +30,7 @@ type SigstoreResults struct {
type SigstoreConfig struct {
CustomTrustedRoot string
Logger *logger.Logger
Logger *logging.Logger
NoPublicGood bool
}
@ -40,7 +40,7 @@ type SigstoreVerifier struct {
customVerifier *verify.SignedEntityVerifier
policy verify.PolicyBuilder
onlyVerifyWithGithub bool
Logger *logger.Logger
Logger *logging.Logger
}
// NewSigstoreVerifier creates a new SigstoreVerifier struct

View file

@ -8,7 +8,7 @@ import (
"github.com/cli/cli/v2/pkg/cmd/attestation/artifact/digest"
"github.com/cli/cli/v2/pkg/cmd/attestation/artifact/oci"
"github.com/cli/cli/v2/pkg/cmd/attestation/api"
"github.com/cli/cli/v2/pkg/cmd/attestation/logger"
"github.com/cli/cli/v2/pkg/cmd/attestation/logging"
)
// Options captures the options for the verify command
@ -28,7 +28,7 @@ type Options struct {
SANRegex string
Verbose bool
APIClient api.Client
Logger *logger.Logger
Logger *logging.Logger
Limit int
OCIClient oci.Client
}

View file

@ -9,7 +9,7 @@ import (
"github.com/cli/cli/v2/pkg/cmdutil"
"github.com/cli/cli/v2/pkg/cmd/attestation/api"
"github.com/cli/cli/v2/pkg/cmd/attestation/artifact"
"github.com/cli/cli/v2/pkg/cmd/attestation/logger"
"github.com/cli/cli/v2/pkg/cmd/attestation/logging"
"github.com/cli/cli/v2/pkg/cmd/attestation/verification"
"github.com/MakeNowJust/heredoc"
@ -71,7 +71,7 @@ func NewVerifyCmd(f *cmdutil.Factory) *cobra.Command {
opts.APIClient = api.NewLiveClient()
// Create a logger for use throughout the verify command
opts.Logger = logger.NewLogger(f.IOStreams, opts.Quiet, opts.Verbose)
opts.Logger = logging.NewLogger(f.IOStreams, opts.Quiet, opts.Verbose)
// Configure the live OCI client
opts.ConfigureOCIClient()
@ -208,7 +208,7 @@ func RunVerify(opts *Options) error {
return nil
}
func verifySLSAPredicateType(logger *logger.Logger, apr []*verification.AttestationProcessingResult) error {
func verifySLSAPredicateType(logger *logging.Logger, apr []*verification.AttestationProcessingResult) error {
logger.VerbosePrintf("Evaluating attestations have valid SLSA predicate type...\n")
for _, result := range apr {

View file

@ -5,7 +5,7 @@ import (
"github.com/cli/cli/v2/pkg/cmd/attestation/api"
"github.com/cli/cli/v2/pkg/cmd/attestation/artifact/oci"
"github.com/cli/cli/v2/pkg/cmd/attestation/logger"
"github.com/cli/cli/v2/pkg/cmd/attestation/logging"
"github.com/cli/cli/v2/pkg/cmd/attestation/test"
"github.com/cli/cli/v2/pkg/cmd/attestation/verification"
@ -24,7 +24,7 @@ func TestRunVerify(t *testing.T) {
res := test.SuppressAndRestoreOutput()
defer res()
logger := logger.NewSystemLogger()
logger := logging.NewSystemLogger()
publicGoodOpts := Options{
ArtifactPath: test.NormalizeRelativePath("../test/data/sigstore-js-2.1.0.tgz"),
@ -176,7 +176,7 @@ func TestVerifySLSAPredicateType_InvalidPredicate(t *testing.T) {
},
}
err := verifySLSAPredicateType(logger.NewSystemLogger(), apr)
err := verifySLSAPredicateType(logging.NewSystemLogger(), apr)
assert.Error(t, err)
assert.ErrorIs(t, err, ErrNoMatchingSLSAPredicate)
}

View file

@ -5,7 +5,7 @@ import (
"os"
"github.com/cli/cli/v2/pkg/cmdutil"
"github.com/cli/cli/v2/pkg/cmd/attestation/logger"
"github.com/cli/cli/v2/pkg/cmd/attestation/logging"
"github.com/cli/cli/v2/pkg/cmd/attestation/verification"
"github.com/MakeNowJust/heredoc"
@ -34,7 +34,7 @@ func NewVerifyTUFRootCmd(f *cmdutil.Factory) *cobra.Command {
gh attestation tuf-root-verify --mirror https://tuf-repo.github.com --root /path/to/1.root.json
`),
Run: func(cmd *cobra.Command, args []string) {
logger := logger.NewDefaultLogger(f.IOStreams)
logger := logging.NewDefaultLogger(f.IOStreams)
if err := verifyTUFRoot(mirror, root); err != nil {
fmt.Sprintln(logger.IO.Out, logger.ColorScheme.Redf("Failed to verify the TUF repository: %s", err))
os.Exit(1)