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) } }
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) } }
func getLogger(minLogLevel string) log.Logger { log.SetLogLevel(minLogLevel) return log.LogFactory("TestLogger", log.Lager, os.Stdout) }
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))) })