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) } }
// 输出版本号 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) }
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) }
// 输出指定级别的日志信息。 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...) }
// 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...) }
func printSyntaxErrors(errs []error) { for _, v := range errs { colors.Println(out, warnColor, colors.Default, v) } }
func printError(msg ...interface{}) { colors.Println(out, errorColor, colors.Default, msg...) }
func printUsage() { colors.Println(out, contentColor, colors.Default, usage) }