1 Star 0 Fork 0

sqos/beats

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
cli.go 840 Bytes
一键复制 编辑 原始数据 按行查看 历史
//+build linux,go1.8,cgo
package plugin
import (
"flag"
"strings"
"github.com/elastic/beats/libbeat/logp"
)
type pluginList struct {
paths []string
}
func (p *pluginList) String() string {
return strings.Join(p.paths, ",")
}
func (p *pluginList) Set(v string) error {
for _, path := range p.paths {
if path == v {
logp.Warn("%s is already a registered plugin")
return nil
}
}
p.paths = append(p.paths, v)
return nil
}
var plugins = &pluginList{}
func init() {
flag.Var(plugins, "plugin", "Load additional plugins")
}
func Initialize() error {
if len(plugins.paths) > 0 {
logp.Warn("EXPERIMENTAL: loadable plugin support is experimental")
}
for _, path := range plugins.paths {
logp.Info("loading plugin bundle: %v", path)
if err := LoadPlugins(path); err != nil {
return err
}
}
return nil
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/sqos/beats.git
git@gitee.com:sqos/beats.git
sqos
beats
beats
v6.0.0-rc1

搜索帮助