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


Golang loggo.ResetLoggers函數代碼示例

本文整理匯總了Golang中github.com/juju/loggo.ResetLoggers函數的典型用法代碼示例。如果您正苦於以下問題:Golang ResetLoggers函數的具體用法?Golang ResetLoggers怎麽用?Golang ResetLoggers使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了ResetLoggers函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: SetUpTest

func (s *ToolsMetadataSuite) SetUpTest(c *gc.C) {
	s.FakeJujuXDGDataHomeSuite.SetUpTest(c)
	s.AddCleanup(dummy.Reset)
	s.AddCleanup(func(*gc.C) {
		loggo.ResetLoggers()
	})
	cfg, err := config.New(config.UseDefaults, map[string]interface{}{
		"name":            "erewhemos",
		"type":            "dummy",
		"uuid":            coretesting.ModelTag.Id(),
		"controller-uuid": coretesting.ModelTag.Id(),
		"conroller":       true,
	})
	c.Assert(err, jc.ErrorIsNil)
	env, err := environs.Prepare(
		modelcmd.BootstrapContextNoVerify(coretesting.Context(c)),
		jujuclienttesting.NewMemStore(),
		environs.PrepareParams{
			ControllerName: cfg.Name(),
			BaseConfig:     cfg.AllAttrs(),
			CloudName:      "dummy",
		},
	)
	c.Assert(err, jc.ErrorIsNil)
	s.env = env
	loggo.GetLogger("").SetLogLevel(loggo.INFO)

	// Switch the default tools location.
	s.publicStorageDir = c.MkDir()
	s.PatchValue(&tools.DefaultBaseURL, s.publicStorageDir)
}
開發者ID:AlexisBruemmer,項目名稱:juju,代碼行數:31,代碼來源:toolsmetadata_test.go

示例2: SetUpTest

func (s *writerSuite) SetUpTest(c *gc.C) {
	loggo.ResetLoggers()
	loggo.RemoveWriter("default")
	s.logger = loggo.GetLogger("test.writer")
	// Make it so the logger itself writes all messages.
	s.logger.SetLogLevel(loggo.TRACE)
}
開發者ID:njpatel,項目名稱:loggo,代碼行數:7,代碼來源:writer_test.go

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: SetUpTest

func (s *logwriterSuite) SetUpTest(c *gc.C) {
	loggo.ResetLoggers()
	loggo.RemoveWriter("default")
	s.writer = &loggo.TestWriter{}
	err := loggo.RegisterWriter("test", s.writer, loggo.TRACE)
	c.Assert(err, gc.IsNil)
	s.logger = loggo.GetLogger("test.writer")
	// Make it so the logger itself writes all messages.
	s.logger.SetLogLevel(loggo.TRACE)
}
開發者ID:njpatel,項目名稱:loggo,代碼行數:10,代碼來源:logger_test.go

示例8: 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

示例9: SetUpTest

func (s *ToolsMetadataSuite) SetUpTest(c *gc.C) {
	s.FakeJujuHomeSuite.SetUpTest(c)
	s.AddCleanup(func(*gc.C) {
		dummy.Reset()
		loggo.ResetLoggers()
	})
	env, err := environs.PrepareFromName(
		"erewhemos", envcmd.BootstrapContextNoVerify(coretesting.Context(c)), configstore.NewMem())
	c.Assert(err, jc.ErrorIsNil)
	s.env = env
	loggo.GetLogger("").SetLogLevel(loggo.INFO)

	// Switch the default tools location.
	s.publicStorageDir = c.MkDir()
	s.PatchValue(&tools.DefaultBaseURL, s.publicStorageDir)
}
開發者ID:Pankov404,項目名稱:juju,代碼行數:16,代碼來源:toolsmetadata_test.go

示例10: TestInitialState

func (s *LoggerSuite) TestInitialState(c *gc.C) {
	config, err := s.State.EnvironConfig()
	c.Assert(err, jc.ErrorIsNil)
	expected := config.LoggingConfig()

	initial := "<root>=DEBUG;wibble=ERROR"
	c.Assert(expected, gc.Not(gc.Equals), initial)

	loggo.ResetLoggers()
	err = loggo.ConfigureLoggers(initial)
	c.Assert(err, jc.ErrorIsNil)

	loggingWorker, _ := s.makeLogger(c)
	defer worker.Stop(loggingWorker)

	s.waitLoggingInfo(c, expected)
}
開發者ID:felicianotech,項目名稱:juju,代碼行數:17,代碼來源:logger_test.go

示例11: SetUpTest

func (s *ToolsMetadataSuite) SetUpTest(c *gc.C) {
	s.LoggingSuite.SetUpTest(c)
	s.home = coretesting.MakeSampleHome(c)
	s.AddCleanup(func(*gc.C) {
		s.home.Restore()
		dummy.Reset()
		loggo.ResetLoggers()
	})
	env, err := environs.PrepareFromName("erewhemos", coretesting.Context(c), configstore.NewMem())
	c.Assert(err, gc.IsNil)
	s.env = env
	envtesting.RemoveAllTools(c, s.env)
	loggo.GetLogger("").SetLogLevel(loggo.INFO)

	// Switch the default tools location.
	s.publicStorageDir = c.MkDir()
	s.PatchValue(&tools.DefaultBaseURL, s.publicStorageDir)
}
開發者ID:jameinel,項目名稱:core,代碼行數:18,代碼來源:toolsmetadata_test.go

示例12: setLogging

func (logger *Logger) setLogging() {
	loggingConfig, err := logger.api.LoggingConfig(logger.agentConfig.Tag())
	if err != nil {
		log.Errorf("%v", err)
	} else {
		if loggingConfig != logger.lastConfig {
			log.Debugf("reconfiguring logging from %q to %q", logger.lastConfig, loggingConfig)
			loggo.ResetLoggers()
			if err := loggo.ConfigureLoggers(loggingConfig); err != nil {
				// This shouldn't occur as the loggingConfig should be
				// validated by the original Config before it gets here.
				log.Warningf("configure loggers failed: %v", err)
				// Try to reset to what we had before
				loggo.ConfigureLoggers(logger.lastConfig)
			}
			logger.lastConfig = loggingConfig
		}
	}
}
開發者ID:exekias,項目名稱:juju,代碼行數:19,代碼來源:logger.go

示例13: TestConfigureLoggers

func (*loggerSuite) TestConfigureLoggers(c *gc.C) {
	for i, test := range configureLoggersTests {
		c.Logf("test %d: %q", i, test.spec)
		loggo.ResetLoggers()
		err := loggo.ConfigureLoggers(test.spec)
		c.Check(loggo.LoggerInfo(), gc.Equals, test.info)
		if test.err != "" {
			c.Assert(err, gc.ErrorMatches, test.err)
			continue
		}
		c.Assert(err, gc.IsNil)

		// Test that it's idempotent.
		err = loggo.ConfigureLoggers(test.spec)
		c.Assert(err, gc.IsNil)
		c.Assert(loggo.LoggerInfo(), gc.Equals, test.info)

		// Test that calling ConfigureLoggers with the
		// output of LoggerInfo works too.
		err = loggo.ConfigureLoggers(test.info)
		c.Assert(err, gc.IsNil)
		c.Assert(loggo.LoggerInfo(), gc.Equals, test.info)
	}
}
開發者ID:njpatel,項目名稱:loggo,代碼行數:24,代碼來源:logger_test.go

示例14: 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

示例15: SetUpTest

func (s *ConfigSuite) SetUpTest(c *gc.C) {
	s.FakeJujuHomeSuite.SetUpTest(c)
	// Make sure that the defaults are used, which
	// is <root>=WARNING
	loggo.ResetLoggers()
}
開發者ID:klyachin,項目名稱:juju,代碼行數:6,代碼來源:config_test.go


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