geziyor/middleware/log_stats.go
Administrator 688c516c9f 初始化
2024-09-04 16:48:42 +08:00

19 lines
448 B
Go

package middleware
import (
"softdown.com/shusou/geziyor/client"
"softdown.com/shusou/geziyor/internal"
)
// LogStats logs responses
type LogStats struct {
LogDisabled bool
}
func (p *LogStats) ProcessResponse(r *client.Response) {
// LogDisabled check is not necessary, but done here for performance reasons
if !p.LogDisabled {
internal.Logger.Printf("Crawled: (%d) <%s %s>", r.StatusCode, r.Request.Method, r.Request.URL.String())
}
}