예제 #1
0
파일: log_test.go 프로젝트: gofs/logex
func (s *MySuite) TestExample(c *C) {
	// this is not a real test case, just usage & output examples
	logex.Debug("hello world, this is debug log")
	logex.Trace("hi, this is trace log")
	logex.Info("how're you doing, this is info log")
	logex.Warn("Warning! Warning!")
	logex.Fatal("Critical error or fatal!")
}
예제 #2
0
파일: log_test.go 프로젝트: gofs/logex
func (s *MySuite) TestLogLevel(c *C) {
	var b bytes.Buffer
	logex.SetOutput(&b)
	logex.SetLevel(logex.FATAL)

	logex.Debug("hello")
	logex.Trace("world")
	logex.Info("hi")
	logex.Warn("blabla")
	c.Assert(b.Len(), Equals, 0)

	logex.Fatal("fatal")
	c.Log(b.String())
	c.Assert(b.Len(), Not(Equals), 0)
}