mirror of
https://github.com/fluxcd/flux2.git
synced 2025-11-02 10:48:03 +08:00
Refactor logging
This commit is contained in:
@ -47,7 +47,7 @@ func init() {
|
||||
func main() {
|
||||
log.SetFlags(0)
|
||||
if err := rootCmd.Execute(); err != nil {
|
||||
fmt.Println(err)
|
||||
logFailure("%v", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
@ -81,3 +81,15 @@ func execCommand(command string) (string, error) {
|
||||
}
|
||||
return string(output), nil
|
||||
}
|
||||
|
||||
func logAction(format string, a ...interface{}) {
|
||||
fmt.Println(`✚`, fmt.Sprintf(format, a...))
|
||||
}
|
||||
|
||||
func logSuccess(format string, a ...interface{}) {
|
||||
fmt.Println(`✔`, fmt.Sprintf(format, a...))
|
||||
}
|
||||
|
||||
func logFailure(format string, a ...interface{}) {
|
||||
fmt.Println(`✗`, fmt.Sprintf(format, a...))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user