當前位置: 首頁>>代碼示例>>Golang>>正文


Golang loggo.ResetWriters函數代碼示例

本文整理匯總了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)
}
開發者ID:jimmiebtlr,項目名稱:testing,代碼行數:7,代碼來源:log.go

示例2: SetUpTest

func (s *LogSuite) SetUpTest(c *gc.C) {
	s.CleanupSuite.SetUpTest(c)
	s.AddCleanup(func(_ *gc.C) {
		loggo.ResetLoggers()
		loggo.ResetWriters()
	})
}
開發者ID:bogdanteleaga,項目名稱:cmd,代碼行數:7,代碼來源:logging_test.go

示例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()
	})
}
開發者ID:rogpeppe,項目名稱:juju-cmd,代碼行數:8,代碼來源:logging_test.go

示例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()
	})
}
開發者ID:howbazaar,項目名稱:testing,代碼行數:8,代碼來源:log.go

示例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...)
}
開發者ID:bac,項目名稱:juju,代碼行數:10,代碼來源:package_test.go

示例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)
}
開發者ID:fabricematrat,項目名稱:testing,代碼行數:11,代碼來源:log.go

示例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"},
	})
}
開發者ID:howbazaar,項目名稱:testing,代碼行數:17,代碼來源:log_test.go

示例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)
}
開發者ID:jameinel,項目名稱:core,代碼行數:18,代碼來源:service_test.go

示例9: SetUpTest

func (*auditSuite) SetUpTest(c *gc.C) {
	loggo.ResetLoggers()
	loggo.ResetWriters()
	err := loggo.ConfigureLoggers(`<root>=ERROR; audit=INFO`)
	c.Assert(err, jc.ErrorIsNil)
}
開發者ID:imoapps,項目名稱:juju,代碼行數:6,代碼來源:audit_test.go

示例10: TearDownTest

func (s *writerBasicsSuite) TearDownTest(c *gc.C) {
	loggo.ResetWriters()
}
開發者ID:njpatel,項目名稱:loggo,代碼行數:3,代碼來源:writer_test.go

示例11: setUp

func (t *LoggingSuite) setUp(c *gc.C) {
	loggo.ResetWriters()
	loggo.ReplaceDefaultWriter(&gocheckWriter{c})
	loggo.ResetLoggers()
}
開發者ID:howbazaar,項目名稱:testing,代碼行數:5,代碼來源:log.go

示例12: TearDownTest

func (s *logwriterSuite) TearDownTest(c *gc.C) {
	loggo.ResetWriters()
}
開發者ID:njpatel,項目名稱:loggo,代碼行數:3,代碼來源:logger_test.go

示例13: TearDownSuite

func (s *LoggingSuite) TearDownSuite(c *gc.C) {
	loggo.ResetLoggers()
	loggo.ResetWriters()
}
開發者ID:rogpeppe,項目名稱:juju-testing,代碼行數:4,代碼來源:log.go


注:本文中的github.com/juju/loggo.ResetWriters函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。