Only keeping the last 1000 log messages in console.
This commit is contained in:
parent
d8c0f489aa
commit
8d8753f008
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user