Closed jimmyrcom closed 7 years ago
For example if the server is shutting down or the user clicks Ctrl+C on a console application, the log will flush any pending messages.
This can be tested file_logger_test.go with the following lines. Execute then click ctrl+c
logger, err := toolbox.NewFileLogger(toolbox.FileLoggerConfig{ LogType: "test", FileTemplate: "/tmp/interrupt.log", QueueFlashCount: 500000, MaxQueueSize: 100000, FlushRequencyInMs: 120000, MaxIddleTimeInSec: 100000, }) assert.NotNil(t, err) logger.Log(&toolbox.LogMessage{ MessageType: "test", Message: fmt.Sprintf("Hello"), }) time.Sleep(400 * time.Millisecond) logger.Log(&toolbox.LogMessage{ MessageType: "test", Message: fmt.Sprintf("World"), }) time.Sleep(1000 * time.Second)
Because the test is a terminate process test, I don't see how we could add it to the test suite.
For example if the server is shutting down or the user clicks Ctrl+C on a console application, the log will flush any pending messages.
This can be tested file_logger_test.go with the following lines. Execute then click ctrl+c
Because the test is a terminate process test, I don't see how we could add it to the test suite.