Example #1
0
File: logger.go Project: sqp/godock
// Format returns a formatted message in the given color with endline.
//
func Format(col, sender, msg string, more ...interface{}) string {
	return fmt.Sprintln(append([]interface{}{
		time.Now().Format("15:04:05"),
		color.Yellow(sender),
		strhelp.Bracket(color.Colored(msg, col))},
		more...)...)
}
Example #2
0
File: logger.go Project: sqp/godock
// Render displays the msg argument in the given color. The colored message is
// passed with others to classic println.
//
func Render(col, msg string, more ...interface{}) {
	// println(, list...)
	list := append([]interface{}{time.Now().Format("15:04:05"), color.Yellow(caller()), strhelp.Bracket(color.Colored(msg, col))}, more...)
	fmt.Println(list...)
	// log.Println(list...)
}
Example #3
0
File: logger.go Project: sqp/godock
// Warn test and log the error as Warning type. Return true if an error was found.
//
func Warn(e error, msg string) (fail bool) {
	return l(e, color.Yellow("Warning"), msg)
}
Example #4
0
File: logger.go Project: sqp/godock
// SetPrefix set the prefix of the logger display.
//
func SetPrefix(pre string) {
	std.SetPrefix(color.Yellow("[" + pre + "] "))
	log.SetPrefix(color.Yellow("[" + pre + "] "))
	log.SetFlags(log.Ltime)
}