1
// Copyright 2012, 2013 Canonical Ltd.
2
// Licensed under the AGPLv3, see LICENCE file for details.
10
. "launchpad.net/gocheck"
14
// LoggingSuite redirects the juju logger to the test logger
15
// when embedded in a gocheck suite type.
16
type LoggingSuite struct {
20
type gocheckWriter struct {
24
func (w *gocheckWriter) Write(level loggo.Level, module, filename string, line int, timestamp time.Time, message string) {
25
// Magic calldepth value...
26
w.c.Output(3, fmt.Sprintf("%s %s %s", level, module, message))
29
func (t *LoggingSuite) SetUpSuite(c *C) {}
30
func (t *LoggingSuite) TearDownSuite(c *C) {}
32
func (t *LoggingSuite) SetUpTest(c *C) {
34
loggo.ReplaceDefaultWriter(&gocheckWriter{c})
36
loggo.GetLogger("juju").SetLogLevel(loggo.DEBUG)
39
func (t *LoggingSuite) TearDownTest(c *C) {