Skip to content

Commit

Permalink
distinguish between log and output (#119)
Browse files Browse the repository at this point in the history
  • Loading branch information
mandelsoft authored Sep 27, 2022
1 parent cff4051 commit c5654dc
Show file tree
Hide file tree
Showing 18 changed files with 23 additions and 10 deletions.
3 changes: 1 addition & 2 deletions cmds/helminstaller/app/execute.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"strings"

"github.com/mandelsoft/vfs/pkg/osfs"
"github.com/sirupsen/logrus"

"github.com/open-component-model/ocm/cmds/helminstaller/app/driver"
"github.com/open-component-model/ocm/pkg/common"
Expand Down Expand Up @@ -60,7 +59,7 @@ func Execute(d driver.Driver, action string, ctx ocm.Context, octx out.Context,
}
defer rcv.Close()

logrus.Infof("Installing helm chart from resource %s@%s", cfg.Chart, common.VersionedElementKey(cv))
fmt.Printf("Installing helm chart from resource %s@%s", cfg.Chart, common.VersionedElementKey(cv))
if acc.Meta().Type != consts.HelmChart {
return errors.Newf("resource type %q required, but found %q", consts.HelmChart, acc.Meta().Type)
}
Expand Down
3 changes: 2 additions & 1 deletion cmds/ocm/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package app

import (
"fmt"
"strings"

_ "github.com/open-component-model/ocm/pkg/contexts/clictx/config"
Expand Down Expand Up @@ -275,7 +276,7 @@ func NewVersionCommand() *cobra.Command {
Short: "displays the version",
Run: func(cmd *cobra.Command, args []string) {
v := version.Get()
logrus.Infof("%#v", v)
fmt.Printf("%#v", v)
},
}
}
1 change: 1 addition & 0 deletions cmds/ocm/commands/ocmcmds/components/get/cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/open-component-model/ocm/cmds/ocm/testhelper"

"github.com/sirupsen/logrus"

"github.com/open-component-model/ocm/pkg/common/accessio"
Expand Down
1 change: 1 addition & 0 deletions cmds/ocm/commands/ocmcmds/components/transfer/cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/open-component-model/ocm/cmds/ocm/testhelper"

"github.com/sirupsen/logrus"

"github.com/open-component-model/ocm/pkg/common/accessio"
Expand Down
2 changes: 1 addition & 1 deletion cmds/ocm/commands/ocmcmds/components/verify/cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ import (
. "github.com/onsi/gomega"
. "github.com/open-component-model/ocm/cmds/ocm/testhelper"
. "github.com/open-component-model/ocm/pkg/contexts/ocm/signing"
"github.com/sirupsen/logrus"

"github.com/mandelsoft/vfs/pkg/vfs"
"github.com/sirupsen/logrus"

"github.com/open-component-model/ocm/pkg/common/accessio"
"github.com/open-component-model/ocm/pkg/common/accessobj"
Expand Down
1 change: 1 addition & 0 deletions cmds/ocm/commands/ocmcmds/resources/get/cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/open-component-model/ocm/cmds/ocm/testhelper"

"github.com/sirupsen/logrus"

"github.com/open-component-model/ocm/pkg/common/accessio"
Expand Down
1 change: 1 addition & 0 deletions cmds/ocm/commands/ocmcmds/sources/add/cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/open-component-model/ocm/cmds/ocm/testhelper"

"github.com/sirupsen/logrus"

"github.com/open-component-model/ocm/pkg/common"
Expand Down
6 changes: 3 additions & 3 deletions cmds/ocm/pkg/output/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ package output
import (
"bytes"
"encoding/json"
"fmt"
"os"

. "github.com/open-component-model/ocm/pkg/out"
"github.com/sirupsen/logrus"

"sigs.k8s.io/yaml"

Expand Down Expand Up @@ -280,9 +280,9 @@ var log bool

func Print(list []Object, msg string, args ...interface{}) {
if log {
logrus.Infof(msg+":\n", args...)
fmt.Printf(msg+":\n", args...)
for i, e := range list {
logrus.Infof(" %3d %s\n", i, e)
fmt.Printf(" %3d %s\n", i, e)
}
}
}
1 change: 1 addition & 0 deletions cmds/ocm/pkg/processing/processing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/sirupsen/logrus"

"github.com/open-component-model/ocm/cmds/ocm/pkg/data"
Expand Down
1 change: 1 addition & 0 deletions cmds/ocm/pkg/tree/tree_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"strings"

. "github.com/onsi/ginkgo/v2"

"github.com/sirupsen/logrus"

"github.com/open-component-model/ocm/cmds/ocm/pkg/tree"
Expand Down
1 change: 1 addition & 0 deletions docs/reference/ocm.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ ocm [<options>] <sub command> ...
--config string configuration file
-C, --cred stringArray credential setting
-h, --help help for ocm
-v, --verbose enable verbose logging
```

### Description
Expand Down
5 changes: 3 additions & 2 deletions hack/generate-docs/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package main

import (
"fmt"
"os"

"github.com/sirupsen/logrus"
Expand All @@ -17,7 +18,7 @@ func main() {
logrus.Info("> Generate Docs for OCM CLI")

if len(os.Args) != 2 { // expect 2 as the first one is the programm name
logrus.Infof("Expected exactly one argument, but got %d", len(os.Args)-1)
fmt.Fprintf(os.Stderr, "Expected exactly one argument, but got %d", len(os.Args)-1)
os.Exit(1)
}
outputDir := os.Args[1]
Expand All @@ -34,7 +35,7 @@ func main() {

func check(err error) {
if err != nil {
logrus.Error(err.Error())
fmt.Fprintf(os.Stderr, err.Error())
os.Exit(1)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import (

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/sirupsen/logrus"

"github.com/mandelsoft/vfs/pkg/vfs"
"github.com/sirupsen/logrus"

"github.com/open-component-model/ocm/pkg/common/accessio"
"github.com/open-component-model/ocm/pkg/contexts/ocm/accessmethods/localblob"
Expand Down
1 change: 1 addition & 0 deletions pkg/contexts/ocm/compdesc/compdesc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/sirupsen/logrus"

"github.com/open-component-model/ocm/pkg/contexts/ocm/compdesc"
Expand Down
1 change: 1 addition & 0 deletions pkg/contexts/ocm/signing/signing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
. "github.com/onsi/gomega"
. "github.com/open-component-model/ocm/pkg/contexts/ocm/signing"
. "github.com/open-component-model/ocm/pkg/env/builder"

"github.com/sirupsen/logrus"

"github.com/open-component-model/ocm/pkg/common/accessio"
Expand Down
1 change: 1 addition & 0 deletions pkg/runtime/unstructured_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/sirupsen/logrus"

"github.com/open-component-model/ocm/pkg/runtime"
Expand Down
1 change: 1 addition & 0 deletions pkg/signing/normalization_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/sirupsen/logrus"

"github.com/open-component-model/ocm/pkg/contexts/ocm/accessmethods/localblob"
Expand Down
1 change: 1 addition & 0 deletions pkg/toi/install/credentials_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package install_test
import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/sirupsen/logrus"

"github.com/open-component-model/ocm/pkg/contexts/config"
Expand Down

0 comments on commit c5654dc

Please sign in to comment.