Only keeping the last 1000 log messages in console.

This commit is contained in:
Sander Schobers 2019-12-29 17:25:59 +01:00
parent d8c0f489aa
commit 8d8753f008

View File

@ -13,6 +13,9 @@ type Console struct {
func (c *Console) Write(p []byte) (int, error) {
c.messages = append(c.messages, string(bytes.TrimRight(p, "\r\n")))
if len(c.messages) > 1000 {
c.messages = c.messages[1:]
}
return len(p), nil
}