1 Star 0 Fork 0

sqos/beats

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
cli.go 840 Bytes
Copy Edit Raw Blame History
//+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.2.3

Search

0d507c66 1850385 C8b1a773 1850385