projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch '18995-code-cleanup-1'
[arvados.git]
/
lib
/
costanalyzer
/
cmd.go
diff --git
a/lib/costanalyzer/cmd.go
b/lib/costanalyzer/cmd.go
index c44f328620bdf3f6c9ba9afbde46cf1e9de35cc1..f2a7af49332037ea98fdc93a357563afe5560aa9 100644
(file)
--- a/
lib/costanalyzer/cmd.go
+++ b/
lib/costanalyzer/cmd.go
@@
-8,11
+8,11
@@
import (
"io"
"time"
"io"
"time"
+ "git.arvados.org/arvados.git/lib/cmd"
"git.arvados.org/arvados.git/sdk/go/ctxlog"
"git.arvados.org/arvados.git/sdk/go/ctxlog"
- "github.com/sirupsen/logrus"
)
)
-var Command =
&
command{}
+var Command = command{}
type command struct {
uuids arrayFlags
type command struct {
uuids arrayFlags
@@
-22,25
+22,15
@@
type command struct {
end time.Time
}
end time.Time
}
-type NoPrefixFormatter struct{}
-
-func (f *NoPrefixFormatter) Format(entry *logrus.Entry) ([]byte, error) {
- return []byte(entry.Message), nil
-}
-
// RunCommand implements the subcommand "costanalyzer <collection> <collection> ..."
// RunCommand implements the subcommand "costanalyzer <collection> <collection> ..."
-func (c
*
command) RunCommand(prog string, args []string, stdin io.Reader, stdout, stderr io.Writer) int {
+func (c command) RunCommand(prog string, args []string, stdin io.Reader, stdout, stderr io.Writer) int {
var err error
logger := ctxlog.New(stderr, "text", "info")
var err error
logger := ctxlog.New(stderr, "text", "info")
- defer func() {
- if err != nil {
- logger.Error("\n" + err.Error() + "\n")
- }
- }()
-
- logger.SetFormatter(new(NoPrefixFormatter))
+ logger.SetFormatter(cmd.NoPrefixFormatter{})
exitcode, err := c.costAnalyzer(prog, args, logger, stdout, stderr)
exitcode, err := c.costAnalyzer(prog, args, logger, stdout, stderr)
-
+ if err != nil {
+ logger.Error("\n" + err.Error())
+ }
return exitcode
}
return exitcode
}