go-skeletor/tool/log.go

73 lines
1.3 KiB
Go

package tool
import (
"fmt"
)
var (
Black = Color("\033[1;30m%s\033[0m")
Red = Color("\033[1;31m%s\033[0m")
Green = Color("\033[1;32m%s\033[0m")
Yellow = Color("\033[1;33m%s\033[0m")
Purple = Color("\033[1;34m%s\033[0m")
Magenta = Color("\033[1;35m%s\033[0m")
Teal = Color("\033[1;36m%s\033[0m")
White = Color("\033[1;37m%s\033[0m")
)
func Log(v string) {
fmt.Println(v)
}
func LogInfo(v string) {
fmt.Println(Teal(v))
}
func LogFatal(v string) {
fmt.Println(Red(LogLine("*")))
fmt.Println(Red(v))
fmt.Println(Red(LogLine("*")))
}
func LogLine(car string) string {
v := ""
for i := len(v); len(v) < 100; i++ {
v = v + car
}
return v
}
func LogJobTitle(v string) {
v = "== CMD = " + v + " "
for i := len(v); len(v) < 100; i++ {
v = v + "="
}
fmt.Println("")
fmt.Println("")
fmt.Println(Magenta(LogLine("=")))
fmt.Println(Magenta(v))
fmt.Println(Magenta(LogLine("=")))
}
func LogTitle(v string) {
v = "== " + v + " "
for i := len(v); len(v) < 100; i++ {
v = v + "="
}
fmt.Println("")
fmt.Println("")
fmt.Println(Green(LogLine("=")))
fmt.Println(Green(v))
fmt.Println(Green(LogLine("=")))
}
func Color(colorString string) func(...interface{}) string {
sprint := func(args ...interface{}) string {
return fmt.Sprintf(colorString, fmt.Sprint(args...))
}
return sprint
}