Exemplo n.º 1
0
Arquivo: main.go Projeto: rdrew4/cfops
func init() {

	if logLevel = os.Getenv(logLevelEnv); logLevel != "" {
		log.SetLogLevel(logLevel)
		logger = log.LogFactory("cfops cli", log.Lager, os.Stdout)
		logger.Debug("log level set", log.Data{"level": logLevel})
		cfops.SetLogger(logger)
	}
}
Exemplo n.º 2
0
func init() {
	ExitCode = cleanExitCode

	if logLevel = os.Getenv(logLevelEnv); logLevel != "" {
		log.SetLogLevel(logLevel)
		logger = log.LogFactory("cfdatamanager cli", log.Lager, os.Stdout)
		logger.Debug("log level set", log.Data{"level": logLevel})
		cfdatamanager.SetLogger(logger)
	}
}
Exemplo n.º 3
0
func getLogger(minLogLevel string) log.Logger {
	log.SetLogLevel(minLogLevel)
	return log.LogFactory("TestLogger", log.Lager, os.Stdout)
}
Exemplo n.º 4
0
	var logger *TestLogger
	var testSink *TestSink

	var component = "my-component"
	var action = "my-action"
	var logData = log.Data{
		"foo":      "bar",
		"a-number": 7,
	}
	var anotherLogData = log.Data{
		"baz":      "quux",
		"b-number": 43,
	}

	BeforeEach(func() {
		log.SetLogLevel("debug")
		logger = NewTestLogger(component)
		testSink = logger.TestSink
	})

	var TestLagerFormat = func(level lager.LogLevel) {
		var log lager.LogFormat

		BeforeEach(func() {
			log = testSink.Logs()[0]
		})

		It("outputs a properly-formatted message", func() {
			Ω(log.Message).Should(Equal(fmt.Sprintf("%s.%s", component, action)))
		})