fmt.Fprintf(os.Stdout,"+++ %s is a slow test (took %v)\n",fmt.Formatter(log.NewColoredValue(t.Name(),log.Bold,log.FgYellow)),fmt.Formatter(log.NewColoredValue(took,log.Bold,log.FgYellow)))
}else{
fmt.Fprintf(os.Stdout,"+++ %s is a slow tets (took %v)\n",t.Name(),took)
}
}
timer:=time.AfterFunc(slowFlush,func(){
iflog.CanColorStdout{
fmt.Fprintf(os.Stdout,"+++ %s ... still flushing after %v ...\n",fmt.Formatter(log.NewColoredValue(t.Name(),log.Bold,log.FgRed)),slowFlush)
}else{
fmt.Fprintf(os.Stdout,"+++ %s ... still flushing after %v ...\n",t.Name(),slowFlush)
t.Errorf("Flushing queues failed with error %v",err)
}
timer.Stop()
flushTook:=time.Since(start)-took
ifflushTook>slowFlush{
iflog.CanColorStdout{
fmt.Fprintf(os.Stdout,"+++ %s had a slow clean-up flush (took %v)\n",fmt.Formatter(log.NewColoredValue(t.Name(),log.Bold,log.FgRed)),fmt.Formatter(log.NewColoredValue(flushTook,log.Bold,log.FgRed)))
}else{
fmt.Fprintf(os.Stdout,"+++ %s had a slow clean-up flush (took %v)\n",t.Name(),flushTook)
}
}
_=writerCloser.Close()
}
}
// Printf takes a format and args and prints the string to os.Stdout
funcPrintf(formatstring,args...interface{}){
iflog.CanColorStdout{
fori:=0;i<len(args);i++{
args[i]=log.NewColoredValue(args[i])
}
}
fmt.Fprintf(os.Stdout,"\t"+format,args...)
}
// NewTestLogger creates a TestLogger as a log.LoggerProvider