Simple and fast asynchronous logging.
Two types of loggers : Console layout and file layout
Three log levels: DEBUG, INFO, ERROR
File logger:
LoggerA -channel- FileA
LoggerB -channel- FileB
LoggerN -channel- FileN
func TestConsoleLog(t *testing.T) {
logManager := NewLogManagerConsole()
loggerA := logManager.NewLogger("testLoggerA")
loggerB := logManager.NewLogger("testLoggerB")
loggerA.Info("Some text 1 !")
loggerB.Err("Some text 2 !")
time.Sleep(100 * time.Millisecond)
logManager.DestroyLogManager()
}
func TestFileLog(t *testing.T) {
logManager := NewLogManagerFile("/home/tjoma/test", 1024*1024*5)
loggerA := logManager.NewLogger("testLoggerA")
loggerB := logManager.NewLogger("testLoggerB")
loggerA.Info("loggerA Some text 1 !")
loggerB.Info("loggerB Some text 2 !")
time.Sleep(100 * time.Millisecond)
logManager.DestroyLogManager()
}
Out:
I0604 13:40:03.397765 repair.go:169-Start destroy
I0604 13:40:03.898044 repair.go:173-End destroy
I0604 13:48:27.992297 repair.go:115-Start create services