Exemplo n.º 1
0
Arquivo: logger.go Projeto: 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...)...)
}
Exemplo n.º 2
0
Arquivo: logger.go Projeto: 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...)
}
Exemplo n.º 3
0
Arquivo: logger.go Projeto: 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)
}
Exemplo n.º 4
0
Arquivo: logger.go Projeto: 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)
}