-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from dhenkel92/update_logging
Update logging
- Loading branch information
Showing
9 changed files
with
70 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
package config | ||
|
||
import ( | ||
"fmt" | ||
"github.com/urfave/cli/v2" | ||
"strings" | ||
) | ||
|
||
func newRunConfig(c *cli.Context) RunConfig { | ||
entrypoint := c.String("entrypoint") | ||
command := c.String("command") | ||
|
||
commands := strings.Split(command, " ") | ||
fmt.Println(commands) | ||
|
||
return RunConfig{Command: commands} | ||
return RunConfig{ | ||
Entrypoint: strings.Split(entrypoint, " "), | ||
Command: command, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package types | ||
|
||
import ( | ||
"github.com/dhenkel92/pod-helper/src/kube" | ||
"github.com/dhenkel92/pod-helper/src/log" | ||
"github.com/logrusorgru/aurora" | ||
v1 "k8s.io/api/core/v1" | ||
"strings" | ||
) | ||
|
||
type Result struct { | ||
ExecResult kube.ExecResult | ||
Pod v1.Pod | ||
} | ||
|
||
func (result *Result) Print() { | ||
var text string | ||
var resText string | ||
if result.ExecResult.Error == nil { | ||
text = aurora.Sprintf(aurora.Green("Success on %s"), result.Pod.Name) | ||
resText = result.ExecResult.StdOut | ||
} else { | ||
text = aurora.Sprintf(aurora.Red("Failed on %s"), result.Pod.Name) | ||
resText = result.ExecResult.StdOut | ||
} | ||
|
||
lineByLine := strings.Split(resText, "\n") | ||
|
||
log.Info.Println("----------------------------------------") | ||
log.Info.Println(text) | ||
log.Info.Printf("Result:\n\n\t%s", strings.Join(lineByLine, "\n\t")) | ||
log.Info.Println("----------------------------------------") | ||
} |