fix logger channel blocking

This commit is contained in:
zelig
2014-07-14 18:37:01 +01:00
parent 4d77b7face
commit 5c03adbded
2 changed files with 49 additions and 33 deletions

View File

@@ -28,6 +28,21 @@ func (t *TestLogSystem) GetLogLevel() LogLevel {
return t.level
}
func TestLoggerFlush(t *testing.T) {
logger := NewLogger("TEST")
testLogSystem := &TestLogSystem{level: WarnLevel}
AddLogSystem(testLogSystem)
for i := 0; i < 5; i++ {
logger.Errorf(".")
}
Flush()
Reset()
output := testLogSystem.Output
if output != "[TEST] .[TEST] .[TEST] .[TEST] .[TEST] ." {
t.Error("Expected complete logger output '[TEST] .[TEST] .[TEST] .[TEST] .[TEST] .', got ", output)
}
}
func TestLoggerPrintln(t *testing.T) {
logger := NewLogger("TEST")
testLogSystem := &TestLogSystem{level: WarnLevel}