Debian Codegraph @

vendor/github.com/xyproto/gfx/log.go

raw
1 package gfx
2
3 import (
4 "fmt"
5 "os"
6 )
7
8 // Stdout, and Stderr are open Files pointing to the standard output,
9 // and standard error file descriptors.
10 var (
11 Stdout = os.Stdout
12 Stderr = os.Stderr
13 )
14
15 // Log to standard output.
16 func Log(format string, a ...interface{}) {
17 fmt.Printf(format+"\n", a...)
18 }
19
20 // Fatal prints to os.Stderr, followed by a call to os.Exit(1).
21 func Fatal(v ...interface{}) {
22 fmt.Fprintln(Stderr, v...)
23 os.Exit(1)
24 }
25
26 // Dump all of the arguments to standard output.
27 func Dump(a ...interface{}) {
28 for _, v := range a {
29 Log("%+v", v)
30 }
31 }
32
33 // Printf formats according to a format specifier and writes to standard output.
34 func Printf(format string, a ...interface{}) (n int, err error) {
35 return fmt.Printf(format, a...)
36 }
37
38 // Sprintf formats according to a format specifier and returns the resulting string.
39 func Sprintf(format string, a ...interface{}) string {
40 return fmt.Sprintf(format, a...)
41 }