Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DebugPrint enables/disables console debug printing. DebugPrint = false // Print prints a message. Print = func(data ...interface{}) { consolePrint("Print", Theme["Print"], data...) return } // PrintC prints a message with color. PrintC = func(data ...interface{}) { consolePrint("PrintC", Theme["PrintC"], data...) return } // Printf prints a formatted message. Printf = func(format string, data ...interface{}) { consolePrintf("Print", Theme["Print"], format, data...) return } // Println prints a message with a newline. Println = func(data ...interface{}) { consolePrintln("Print", Theme["Print"], data...) return } // Fatal print a error message and exit. Fatal = func(data ...interface{}) { consolePrint("Fatal", Theme["Fatal"], data...) os.Exit(1) return } // Fatalf print a error message with a format specified and exit. Fatalf = func(format string, data ...interface{}) { consolePrintf("Fatal", Theme["Fatal"], format, data...) os.Exit(1) return } // Fatalln print a error message with a new line and exit. Fatalln = func(data ...interface{}) { consolePrintln("Fatal", Theme["Fatal"], data...) os.Exit(1) return } // Error prints a error message. Error = func(data ...interface{}) { consolePrint("Error", Theme["Error"], data...) return } // Errorf print a error message with a format specified. Errorf = func(format string, data ...interface{}) { consolePrintf("Error", Theme["Error"], format, data...) return } // Errorln prints a error message with a new line. Errorln = func(data ...interface{}) { consolePrintln("Error", Theme["Error"], data...) return } // Info prints a informational message. Info = func(data ...interface{}) { consolePrint("Info", Theme["Info"], data...) return } // Infof prints a informational message in custom format. Infof = func(format string, data ...interface{}) { consolePrintf("Info", Theme["Info"], format, data...) return } // Infoln prints a informational message with a new line. Infoln = func(data ...interface{}) { consolePrintln("Info", Theme["Info"], data...) return } // Debug prints a debug message without a new line // Debug prints a debug message. Debug = func(data ...interface{}) { if DebugPrint { consolePrint("Debug", Theme["Debug"], data...) } } // Debugf prints a debug message with a new line. Debugf = func(format string, data ...interface{}) { if DebugPrint { consolePrintf("Debug", Theme["Debug"], format, data...) } } // Debugln prints a debug message with a new line. Debugln = func(data ...interface{}) { if DebugPrint { consolePrintln("Debug", Theme["Debug"], data...) } } // Colorize prints message in a colorized form, dictated by the corresponding tag argument. Colorize = func(tag string, data interface{}) string { if isatty.IsTerminal(os.Stdout.Fd()) { colorized, ok := Theme[tag] if ok { return colorized.SprintFunc()(data) } } return fmt.Sprint(data) } // Eraseline Print in new line and adjust to top so that we don't print over the ongoing progress bar. Eraseline = func() { consolePrintf("Print", Theme["Print"], "%c[2K\n", 27) consolePrintf("Print", Theme["Print"], "%c[A", 27) } )
View Source
var ( // Theme contains default color mapping. Theme = map[string]*color.Color{ "Debug": color.New(color.FgWhite, color.Faint, color.Italic), "Fatal": color.New(color.FgRed, color.Italic, color.Bold), "Error": color.New(color.FgYellow, color.Italic), "Info": color.New(color.FgGreen, color.Bold), "Print": color.New(), "PrintC": color.New(color.FgGreen, color.Bold), } )
Functions ¶
func ProgramName ¶
func ProgramName() string
ProgramName - return the name of the executable program.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.