Exemple #1
0
// 输出版本号
func printVersion() {
	colors.Print(colors.Stdout, colors.Green, colors.Default, "gobuild: ")
	colors.Println(colors.Stdout, colors.Default, colors.Default, version)
	colors.Print(colors.Stdout, colors.Green, colors.Default, "Go: ")
	goVersion := runtime.Version() + " " + runtime.GOOS + "/" + runtime.GOARCH
	colors.Println(colors.Stdout, colors.Default, colors.Default, goVersion)
}
Exemple #2
0
func printVersion() {
	colors.Print(out, titleColor, colors.Default, "apidoc: ")
	colors.Println(out, contentColor, colors.Default, version)

	colors.Print(out, titleColor, colors.Default, "Go: ")
	goVersion := runtime.Version() + " " + runtime.GOOS + "/" + runtime.GOARCH
	colors.Println(out, contentColor, colors.Default, goVersion)
}
Exemple #3
0
// 输出指定级别的日志信息。
func log(level logLevel, msg ...interface{}) {
	if level < 0 || level >= max {
		panic("log:无效的level值")
	}

	if level == ignore && !showIgnoreLog {
		return
	}

	data := time.Now().Format("2006-01-02 15:04:05 ")
	colors.Print(colors.Stdout, colors.Default, colors.Default, data)
	colors.Print(colors.Stdout, levelColors[level], colors.Default, "[", levelStrings[level], "] ")
	colors.Println(colors.Stdout, levelColors[level], colors.Default, msg...)
}
Exemple #4
0
func printLangs() {
	colors.Println(out, titleColor, colors.Default, "目前支持以下类型的代码解析:")
	for k, v := range langs {
		colors.Print(out, titleColor, colors.Default, k, ":")
		colors.Println(out, contentColor, colors.Default, v.exts)
	}
}
Exemple #5
0
// Messageln 向终端输出不同颜色的提示信息,带换行符
func Messageln(out int, color colors.Color, prefix string, v ...interface{}) {
	colors.Print(out, color, colors.Default, prefix)
	colors.Println(out, colors.Default, colors.Default, v...)
}
Exemple #6
0
func printErr(msg string) {
	colors.Print(colors.Stdout, colors.Red, colors.Black, msg+"\n")
	fmt.Print("Press 'Enter' to continue...")
	bufio.NewReader(os.Stdin).ReadBytes('\n')
	os.Exit(1)
}