mirror of https://github.com/fluffle/goirc
gofix weekly fixes for logging.
This commit is contained in:
parent
f62470c091
commit
3710f67670
|
@ -1,7 +1,6 @@
|
||||||
package logging
|
package logging
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
@ -13,7 +12,7 @@ type mockWriter struct {
|
||||||
written []byte
|
written []byte
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *mockWriter) Write(p []byte) (n int, err os.Error) {
|
func (w *mockWriter) Write(p []byte) (n int, err error) {
|
||||||
w.written = append(w.written, p...)
|
w.written = append(w.written, p...)
|
||||||
return len(p), nil
|
return len(p), nil
|
||||||
}
|
}
|
||||||
|
@ -62,7 +61,7 @@ func newMock(t *testing.T) (*logger, *writerMap) {
|
||||||
logMap[lv] = makeLogger(w)
|
logMap[lv] = makeLogger(w)
|
||||||
}
|
}
|
||||||
// Set the default log level high enough that everything will get logged
|
// Set the default log level high enough that everything will get logged
|
||||||
return New(logMap, (1 << 31) - 1, false), wMap
|
return New(logMap, (1<<31)-1, false), wMap
|
||||||
}
|
}
|
||||||
|
|
||||||
// When you expect something to be logged but don't care so much what level at.
|
// When you expect something to be logged but don't care so much what level at.
|
||||||
|
@ -89,7 +88,6 @@ func (wm *writerMap) Expect(exp string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// When you expect nothing to be logged
|
// When you expect nothing to be logged
|
||||||
func (wm *writerMap) ExpectNothing() {
|
func (wm *writerMap) ExpectNothing() {
|
||||||
for lv, w := range wm.m {
|
for lv, w := range wm.m {
|
||||||
|
|
Loading…
Reference in New Issue