You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ntool/nlog/lesswriter.go

23 lines
396 B
Go

package nlog
import "io"
type lessWriter struct {
*limitedExecutor
writer io.Writer
}
func newLessWriter(writer io.Writer, milliseconds int) *lessWriter {
return &lessWriter{
limitedExecutor: newLimitedExecutor(milliseconds),
writer: writer,
}
}
func (w *lessWriter) Write(p []byte) (n int, err error) {
w.logOrDiscard(func() {
w.writer.Write(p)
})
return len(p), nil
}