1 Star 0 Fork 0

zhangjungang/beats

Create your Gitee Account
Explore and code with more than 13.5 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
plugin.go 690 Bytes
Copy Edit Raw Blame History
Steffen Siering authored 2017-01-13 19:38 +08:00 . Experimental go1.8 plugin support (#3217)
package outputs
import (
"errors"
"fmt"
p "github.com/elastic/beats/libbeat/plugin"
)
type outputPlugin struct {
name string
builder OutputBuilder
}
var pluginKey = "libbeat.output"
func Plugin(name string, l OutputBuilder) map[string][]interface{} {
return p.MakePlugin(pluginKey, outputPlugin{name, l})
}
func init() {
p.MustRegisterLoader(pluginKey, func(ifc interface{}) error {
b, ok := ifc.(outputPlugin)
if !ok {
return errors.New("plugin does not match output plugin type")
}
name := b.name
if outputsPlugins[name] != nil {
return fmt.Errorf("output type %v already registered", name)
}
RegisterOutputPlugin(name, b.builder)
return nil
})
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zhangjungang/beats.git
git@gitee.com:zhangjungang/beats.git
zhangjungang
beats
beats
v5.3.1

Search