|
|
@ -58,6 +58,22 @@ func TestLoggerFatalln(t *testing.T) {
|
|
|
|
assert.Contains(t, builder.String(), content)
|
|
|
|
assert.Contains(t, builder.String(), content)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func TestLoggerInfo(t *testing.T) {
|
|
|
|
|
|
|
|
var builder strings.Builder
|
|
|
|
|
|
|
|
log.SetOutput(&builder)
|
|
|
|
|
|
|
|
logger := new(Logger)
|
|
|
|
|
|
|
|
logger.Info(content)
|
|
|
|
|
|
|
|
assert.Empty(t, builder.String())
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func TestLoggerInfof(t *testing.T) {
|
|
|
|
|
|
|
|
var builder strings.Builder
|
|
|
|
|
|
|
|
log.SetOutput(&builder)
|
|
|
|
|
|
|
|
logger := new(Logger)
|
|
|
|
|
|
|
|
logger.Infof(content)
|
|
|
|
|
|
|
|
assert.Empty(t, builder.String())
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func TestLoggerWarning(t *testing.T) {
|
|
|
|
func TestLoggerWarning(t *testing.T) {
|
|
|
|
var builder strings.Builder
|
|
|
|
var builder strings.Builder
|
|
|
|
log.SetOutput(&builder)
|
|
|
|
log.SetOutput(&builder)
|
|
|
@ -66,6 +82,14 @@ func TestLoggerWarning(t *testing.T) {
|
|
|
|
assert.Empty(t, builder.String())
|
|
|
|
assert.Empty(t, builder.String())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func TestLoggerInfoln(t *testing.T) {
|
|
|
|
|
|
|
|
var builder strings.Builder
|
|
|
|
|
|
|
|
log.SetOutput(&builder)
|
|
|
|
|
|
|
|
logger := new(Logger)
|
|
|
|
|
|
|
|
logger.Infoln(content)
|
|
|
|
|
|
|
|
assert.Empty(t, builder.String())
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func TestLoggerWarningf(t *testing.T) {
|
|
|
|
func TestLoggerWarningf(t *testing.T) {
|
|
|
|
var builder strings.Builder
|
|
|
|
var builder strings.Builder
|
|
|
|
log.SetOutput(&builder)
|
|
|
|
log.SetOutput(&builder)
|
|
|
@ -81,3 +105,11 @@ func TestLoggerWarningln(t *testing.T) {
|
|
|
|
logger.Warningln(content)
|
|
|
|
logger.Warningln(content)
|
|
|
|
assert.Empty(t, builder.String())
|
|
|
|
assert.Empty(t, builder.String())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func TestLogger_V(t *testing.T) {
|
|
|
|
|
|
|
|
logger := new(Logger)
|
|
|
|
|
|
|
|
// grpclog.fatalLog
|
|
|
|
|
|
|
|
assert.True(t, logger.V(3))
|
|
|
|
|
|
|
|
// grpclog.infoLog
|
|
|
|
|
|
|
|
assert.False(t, logger.V(0))
|
|
|
|
|
|
|
|
}
|
|
|
|