func (s *MySuite) TestMaxLineSize(c *C) { var b bytes.Buffer logger := logex.New(logex.DEBUG, &b, 50) logger.Debug("abcdefghijklmnopqrstuvwxyz01234567890") c.Log(b.String()) c.Assert(b.Len(), Equals, 50) }
func (s *MySuite) TestFormat(c *C) { var b bytes.Buffer logger := logex.New(logex.DEBUG, &b, 1000) logger.Debug("hello %d", 123) _, fullpath, line, _ := runtime.Caller(0) file := path.Base(fullpath) buf := b.Bytes() c.Log(b.String()) c.Assert(buf[0], Equals, uint8('D')) c.Assert(string(buf[19:]), Equals, fmt.Sprintf("%s:%d] hello 123\n", file, line-1)) }