You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
396 B
23 lines
396 B
1 year ago
|
package logx
|
||
|
|
||
|
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 (l *lessWriter) Write(p []byte) (n int, err error) {
|
||
|
l.logOrDiscard(func() {
|
||
|
l.writer.Write(p)
|
||
|
})
|
||
|
return len(p), nil
|
||
|
}
|