8 // Log calls log.Println but first transforms strings so they are
9 // safer to write in logs (e.g., 'foo"bar' becomes
10 // '"foo\"bar"'). Arguments that aren't strings and don't have a
11 // (String() string) method are left alone.
12 func Log(args ...interface{}) {
13 newargs := make([]interface{}, len(args))
14 for i, arg := range args {
15 if s, ok := arg.(string); ok {
16 newargs[i] = fmt.Sprintf("%+q", s)
17 } else if s, ok := arg.(fmt.Stringer); ok {
18 newargs[i] = fmt.Sprintf("%+q", s.String())
23 log.Println(newargs...)