Exemple #1
0
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!")
}
Exemple #2
0
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)
}