예제 #1
0
파일: main.go 프로젝트: 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)
	}
}
예제 #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)
	}
}
예제 #3
0
func getLogger(minLogLevel string) log.Logger {
	log.SetLogLevel(minLogLevel)
	return log.LogFactory("TestLogger", log.Lager, os.Stdout)
}
예제 #4
0
파일: logapi_test.go 프로젝트: rdrew4/cfops
	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)))
		})