1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
package testing
import (
"launchpad.net/gocheck"
"launchpad.net/juju/go/log"
)
// LoggingSuite redirects the juju logger to the test logger
// when embedded in a gocheck suite type.
type LoggingSuite struct {
oldTarget log.Logger
oldDebug bool
}
func (t *LoggingSuite) SetUpTest(c *gocheck.C) {
t.oldTarget = log.Target
t.oldDebug = log.Debug
log.Debug = true
log.Target = c
}
func (t *LoggingSuite) TearDownTest(c *gocheck.C) {
log.Target = t.oldTarget
log.Debug = t.oldDebug
}
|