This repository was archived by the owner on Sep 28, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathlog.go
More file actions
63 lines (53 loc) · 1.29 KB
/
log.go
File metadata and controls
63 lines (53 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package log
import (
"fmt"
"github.com/fatih/color"
)
func printGood() {
color.New(color.FgGreen).Printf("+++ ")
}
func printNotice() {
color.New(color.FgYellow).Printf("--- ")
}
// BuildStep logs a build step.
func BuildStep(step, command string) {
printGood()
color.New(color.Bold, color.FgWhite).Printf("Execute: ")
color.Green(fmt.Sprintf("%s %s", step, command))
color.Unset()
}
// CacheHit logs a cache hit.
func CacheHit(imageID string) {
printGood()
color.New(color.FgWhite, color.Bold, color.BgRed).Printf("Cache hit:")
color.New(color.FgCyan).Printf(" using %q\n", imageID)
color.Unset()
}
// CopyPath logs a copied path
func CopyPath(file1, file2 string) {
printNotice()
color.New(color.FgMagenta).Printf("COPY: ")
color.Unset()
fmt.Printf("%q -> %q\n", file1, file2)
}
// Tag logs a tag
func Tag(name string) {
printGood()
color.New(color.FgYellow).Printf("Tagged: ")
color.Unset()
fmt.Println(name)
}
// EvalResponse logs the eval response
func EvalResponse(response string) {
printGood()
color.New(color.FgWhite, color.Bold).Printf("Eval Response:")
color.Unset()
fmt.Println("", response) // dat whitespace
}
// Finish logs the finish.
func Finish(response string) {
printGood()
color.New(color.FgRed, color.Bold).Printf("Finish: ")
color.Unset()
fmt.Println(response)
}