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.
22 lines
396 B
22 lines
396 B
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 |
|
}
|
|
|