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