New logger for testing. You can set the log level for a given test by using the --log= flag. For example, `go test ./... --log=debug` will run tests with debug logs on.
()
| 22 | // using the --log=<pattern> flag. For example, `go test ./... --log=debug` will |
| 23 | // run tests with debug logs on. |
| 24 | func New() log.Log { |
| 25 | level, err := log.ParseLevel(*logFlag) |
| 26 | if err != nil { |
| 27 | panic(fmt.Sprintf("testlog: invalid --log=[level] %q" + *logFlag)) |
| 28 | } |
| 29 | return log.New(levelfilter.New(console.New(os.Stderr), level)) |
| 30 | } |