...
1 package log
2
3 import (
4 "fmt"
5 "strings"
6
7 "github.com/fatih/color"
8 multierror "github.com/hashicorp/go-multierror"
9 )
10
11 func Success(message ...string) {
12 green := color.New(color.FgGreen).SprintFunc()
13 fmt.Printf("%s - %v\n", green("PASS"), strings.Join(message, " "))
14 }
15
16 func Warn(message ...string) {
17 yellow := color.New(color.FgYellow).SprintFunc()
18 fmt.Printf("%s - %v\n", yellow("WARN"), strings.Join(message, " "))
19 }
20
21 func Error(message error) {
22 if merr, ok := message.(*multierror.Error); ok {
23 for _, serr := range merr.Errors {
24 Error(serr)
25 }
26 } else {
27 red := color.New(color.FgRed).SprintFunc()
28 fmt.Printf("%s - %v\n", red("ERR "), message)
29 }
30 }
31
View as plain text