代码拉取完成,页面将自动刷新
package crawler
import (
"fmt"
"time"
"github.com/elastic/beats/filebeat/harvester"
"github.com/elastic/beats/filebeat/input"
)
type ProspectorStdin struct {
Prospector *Prospector
harvester *harvester.Harvester
started bool
}
func NewProspectorStdin(p *Prospector) (*ProspectorStdin, error) {
prospectorer := &ProspectorStdin{
Prospector: p,
}
var err error
prospectorer.harvester, err = p.createHarvester("-", &input.FileStat{})
if err != nil {
return nil, fmt.Errorf("Error initializing stdin harvester: %v", err)
}
return prospectorer, nil
}
func (p *ProspectorStdin) Init() {
p.started = false
}
func (p *ProspectorStdin) Run() {
// Make sure stdin harvester is only started once
if !p.started {
p.harvester.Start()
p.started = true
}
// Wait time during endless loop
oneSecond, _ := time.ParseDuration("1s")
time.Sleep(oneSecond)
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。