2018-07-22 08:56:23 -05:00
|
|
|
package gaper
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestLoggerDefault(t *testing.T) {
|
2018-10-21 08:16:10 -05:00
|
|
|
l := newLogger("gaper-test")
|
2018-07-22 08:56:23 -05:00
|
|
|
assert.Equal(t, l.verbose, false)
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestLoggerEnableVerbose(t *testing.T) {
|
2018-10-21 08:16:10 -05:00
|
|
|
l := newLogger("gaper-test")
|
2018-07-22 08:56:23 -05:00
|
|
|
l.Verbose(true)
|
|
|
|
assert.Equal(t, l.verbose, true)
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestLoggerRunAllLogsWithoutVerbose(t *testing.T) {
|
|
|
|
// no asserts, just checking it doesn't crash
|
2018-10-21 08:16:10 -05:00
|
|
|
l := newLogger("gaper-test")
|
2018-07-22 08:56:23 -05:00
|
|
|
l.Debug("debug")
|
|
|
|
l.Debugf("%s", "debug")
|
|
|
|
l.Info("info")
|
|
|
|
l.Error("error")
|
|
|
|
l.Errorf("%s", "error")
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestLoggerRunAllLogsWithVerbose(t *testing.T) {
|
|
|
|
// no asserts, just checking it doesn't crash
|
2018-10-21 08:16:10 -05:00
|
|
|
l := newLogger("gaper-test")
|
2018-07-22 08:56:23 -05:00
|
|
|
l.Verbose(true)
|
|
|
|
l.Debug("debug")
|
|
|
|
l.Debugf("%s", "debug")
|
|
|
|
l.Info("info")
|
|
|
|
l.Error("error")
|
|
|
|
l.Errorf("%s", "error")
|
|
|
|
}
|