本文整理匯總了Golang中github.com/juju/loggo.ResetWriters函數的典型用法代碼示例。如果您正苦於以下問題:Golang ResetWriters函數的具體用法?Golang ResetWriters怎麽用?Golang ResetWriters使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了ResetWriters函數的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: setUp
func (s *LoggingSuite) setUp(c *gc.C) {
loggo.ResetWriters()
loggo.ReplaceDefaultWriter(&gocheckWriter{c})
loggo.ResetLoggers()
err := loggo.ConfigureLoggers(logConfig)
c.Assert(err, gc.IsNil)
}
示例2: SetUpTest
func (s *LogSuite) SetUpTest(c *gc.C) {
s.CleanupSuite.SetUpTest(c)
s.AddCleanup(func(_ *gc.C) {
loggo.ResetLoggers()
loggo.ResetWriters()
})
}
示例3: SetUpTest
func (s *LogSuite) SetUpTest(c *gc.C) {
s.CleanupSuite.SetUpTest(c)
s.PatchEnvironment(osenv.JujuLoggingConfigEnvKey, "")
s.AddCleanup(func(_ *gc.C) {
loggo.ResetLoggers()
loggo.ResetWriters()
})
}
示例4: SetUpSuite
func (t *LoggingSuite) SetUpSuite(c *gc.C) {
t.CleanupSuite.SetUpSuite(c)
t.setUp(c)
t.AddSuiteCleanup(func(*gc.C) {
loggo.ResetLoggers()
loggo.ResetWriters()
})
}
示例5: runCommand
func runCommand(c *gc.C, args ...string) (*cmd.Context, error) {
// Writers need to be reset, because
// they are set globally in the juju/cmd package and will
// return an error if we attempt to run two commands in the
// same test.
loggo.ResetWriters()
ctx := coretesting.Context(c)
command := jujucmd.NewJujuCommand(ctx)
return coretesting.RunCommand(c, command, args...)
}
示例6: setUp
func (s *LoggingSuite) setUp(c *gc.C) {
loggo.ResetWriters()
// Don't use the default writer for the test logging, which
// means we can still get logging output from tests that
// replace the default writer.
loggo.ReplaceDefaultWriter(discardWriter{})
loggo.RegisterWriter("loggingsuite", &gocheckWriter{c}, loggo.TRACE)
loggo.ResetLoggers()
err := loggo.ConfigureLoggers(logConfig)
c.Assert(err, gc.IsNil)
}
示例7: TestFromLogMatches
func (s *LogMatchesSuite) TestFromLogMatches(c *gc.C) {
tw := &loggo.TestWriter{}
_, err := loggo.ReplaceDefaultWriter(tw)
c.Assert(err, gc.IsNil)
defer loggo.ResetWriters()
logger := loggo.GetLogger("test")
logger.SetLogLevel(loggo.DEBUG)
logger.Infof("foo")
logger.Debugf("bar")
logger.Tracef("hidden")
c.Check(tw.Log, jc.LogMatches, []string{"foo", "bar"})
c.Check(tw.Log, gc.Not(jc.LogMatches), []string{"foo", "bad"})
c.Check(tw.Log, gc.Not(jc.LogMatches), []jc.SimpleMessage{
{loggo.INFO, "foo"},
{loggo.INFO, "bar"},
})
}
示例8: TestSetUnsupportedConstraintsWarning
func (s *ServiceSuite) TestSetUnsupportedConstraintsWarning(c *gc.C) {
defer loggo.ResetWriters()
logger := loggo.GetLogger("test")
logger.SetLogLevel(loggo.DEBUG)
tw := &loggo.TestWriter{}
c.Assert(loggo.RegisterWriter("constraints-tester", tw, loggo.DEBUG), gc.IsNil)
cons := constraints.MustParse("mem=4G cpu-power=10")
err := s.mysql.SetConstraints(cons)
c.Assert(err, gc.IsNil)
c.Assert(tw.Log, jc.LogMatches, jc.SimpleMessages{{
loggo.WARNING,
`setting constraints on service "mysql": unsupported constraints: cpu-power`},
})
scons, err := s.mysql.Constraints()
c.Assert(err, gc.IsNil)
c.Assert(scons, gc.DeepEquals, cons)
}
示例9: SetUpTest
func (*auditSuite) SetUpTest(c *gc.C) {
loggo.ResetLoggers()
loggo.ResetWriters()
err := loggo.ConfigureLoggers(`<root>=ERROR; audit=INFO`)
c.Assert(err, jc.ErrorIsNil)
}
示例10: TearDownTest
func (s *writerBasicsSuite) TearDownTest(c *gc.C) {
loggo.ResetWriters()
}
示例11: setUp
func (t *LoggingSuite) setUp(c *gc.C) {
loggo.ResetWriters()
loggo.ReplaceDefaultWriter(&gocheckWriter{c})
loggo.ResetLoggers()
}
示例12: TearDownTest
func (s *logwriterSuite) TearDownTest(c *gc.C) {
loggo.ResetWriters()
}
示例13: TearDownSuite
func (s *LoggingSuite) TearDownSuite(c *gc.C) {
loggo.ResetLoggers()
loggo.ResetWriters()
}