示例#1
0
// LErr is a function for non-fatal errors.  It will always log to file and
// optionally with -debug print to stdout and also will have nice colored
// output as long as -nocolor is not supplied.
func LErr(i ...interface{}) {
	s := TypeString(i)
	if DebugLog {
		if Color {
			term.Red(os.Stdout, "Error: "+s+"\n")
		} else {
			fmt.Print("Error: " + s)
		}
	}
	Log.SetPrefix("WARN ")
	Log.Println("Error: ", s)
	Log.SetPrefix("")
}
示例#2
0
func main() {
	// On windows, it is possible, though unlikely,
	// to fail to write to the console. An error
	// is returned.
	f := os.Stdout

	if err := term.Black(f, "Black"); err != nil {
		fmt.Printf("Stupid windows system calls: %v\n", err)
	}

	fmt.Println()
	term.White(f, "White")
	fmt.Println()
	term.Red(f, "Red")
	fmt.Println()
	term.LightRed(f, "Light Red")
	fmt.Println()
	term.Green(f, "Green")
	fmt.Println()
	term.LightGreen(f, "Light Green")
	fmt.Println()
	term.DarkYellow(f, "Dark Yellow")
	fmt.Println()
	term.LightYellow(f, "Light Yellow")
	fmt.Println()
	term.Blue(f, "Blue")
	fmt.Println()
	term.LightBlue(f, "Light Blue")
	fmt.Println()
	term.Magenta(f, "Magenta")
	fmt.Println()
	term.LightMagenta(f, "Light Magenta")
	fmt.Println()
	term.Cyan(f, "Cyan")
	fmt.Println()
	term.LightCyan(f, "Light Cyan")
	fmt.Println()
}