mirror of https://bitbucket.org/ausocean/av.git
Only dump stack for Fatal log messages.
This commit is contained in:
parent
db265404eb
commit
437470b53f
|
@ -14,6 +14,8 @@ const raspividPath = "/usr/local/bin/raspivid"
|
||||||
// Suppress all test logging, except for t.Errorf output.
|
// Suppress all test logging, except for t.Errorf output.
|
||||||
var silent bool
|
var silent bool
|
||||||
|
|
||||||
|
// TestRaspivid tests that raspivid starts correctly.
|
||||||
|
// It is intended to be run on a Raspberry Pi.
|
||||||
func TestRaspivid(t *testing.T) {
|
func TestRaspivid(t *testing.T) {
|
||||||
if _, err := os.Stat(raspividPath); os.IsNotExist(err) {
|
if _, err := os.Stat(raspividPath); os.IsNotExist(err) {
|
||||||
t.Skip("Skipping TestRaspivid since no raspivid found.")
|
t.Skip("Skipping TestRaspivid since no raspivid found.")
|
||||||
|
@ -44,6 +46,7 @@ func TestRaspivid(t *testing.T) {
|
||||||
// testLogger implements a netsender.Logger.
|
// testLogger implements a netsender.Logger.
|
||||||
type testLogger struct{}
|
type testLogger struct{}
|
||||||
|
|
||||||
|
// SetLevel normally sets the logging level, but it is a no-op in our case.
|
||||||
func (tl *testLogger) SetLevel(level int8) {
|
func (tl *testLogger) SetLevel(level int8) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,8 +59,7 @@ func (tl *testLogger) Log(level int8, msg string, params ...interface{}) {
|
||||||
if !silent {
|
if !silent {
|
||||||
fmt.Printf("%s: %s\n", logLevels[level+1], msg)
|
fmt.Printf("%s: %s\n", logLevels[level+1], msg)
|
||||||
}
|
}
|
||||||
if level >= 4 {
|
if level == 5 {
|
||||||
// Error or Fatal
|
|
||||||
buf := make([]byte, 1<<16)
|
buf := make([]byte, 1<<16)
|
||||||
size := runtime.Stack(buf, true)
|
size := runtime.Stack(buf, true)
|
||||||
fmt.Printf("%s\n", string(buf[:size]))
|
fmt.Printf("%s\n", string(buf[:size]))
|
||||||
|
|
Loading…
Reference in New Issue