示例#1
0
func TestSimpleBufferLogger(t *testing.T) {
	fw, _ := writer.NewFileWriter("/tmp/test_simple_buffer_logger.log")
	bw := buffer.NewBuffer(fw, 1024)
	logger, _ := NewSimpleLogger(bw, LEVEL_INFO, new(SimpleFormater))

	msg := []byte("test simple buffer logger")

	testLogger(logger, msg)

	logger.Free()
}
示例#2
0
func asyncWebLogger(wg *sync.WaitGroup) {
	defer wg.Done()

	fw, _ := writer.NewFileWriter("/tmp/test_async_web_logger.log")
	bw := buffer.NewBuffer(fw, 1024)
	sl, _ := NewSimpleLogger(bw, LEVEL_INFO, NewWebFormater([]byte("async_web"), []byte("127.0.0.1")))
	logger := NewAsyncLogger(sl, NewAsyncLogRoutine(10))

	msg := []byte("test async web logger")

	testLogger(logger, msg)

	logger.Free()
}
示例#3
0
func asyncSimpleLogger(wg *sync.WaitGroup) {
	defer wg.Done()

	fw, _ := writer.NewFileWriter("/tmp/test_async_simple_logger.log")
	bw := buffer.NewBuffer(fw, 1024)
	sl, _ := NewSimpleLogger(bw, LEVEL_INFO, new(SimpleFormater))
	logger := NewAsyncLogger(sl, NewAsyncLogRoutine(10))

	msg := []byte("test async simple logger")

	testLogger(logger, msg)
	time.Sleep(time.Second * 3)

	logger.Free()
}