func (w *Writer) Write(p []byte) (n int, err error) {
	text := strings.TrimSuffix(string(p), "\n")
	if count, ok := w.messages[text]; ok {
		w.messages[text] = count + 1
	} else {
		w.messages[text] = 1
	}
	return len(text), nil
}
Write implements Writer interface
package logging
import (
	"fmt"
	"io"
	"strings"
)
type Writer struct {
	messages map[string]uint64
}
func NewWriter() *Writer {
	return &Writer{
		messages: make(map[string]uint64),
	}
}