Run benchmarks when running tests

This commit is contained in:
Jakob Borg
2015-05-23 15:08:17 +02:00
parent a2b94f4e06
commit 8dd7e4e6b5
6 changed files with 115 additions and 95 deletions

View File

@@ -6,6 +6,7 @@ package logger
import (
"fmt"
"io/ioutil"
"log"
"os"
"strings"
@@ -37,6 +38,13 @@ type Logger struct {
var DefaultLogger = New()
func New() *Logger {
if os.Getenv("LOGGER_DISCARD") != "" {
// Hack to completely disable logging, for example when running benchmarks.
return &Logger{
logger: log.New(ioutil.Discard, "", 0),
}
}
return &Logger{
logger: log.New(os.Stdout, "", log.Ltime),
}