feat: add flag --log-plugin to turn on plugin logging

This commit is contained in:
debugtalk
2022-02-25 17:26:02 +08:00
parent d7be9c938e
commit 026384bbdb
14 changed files with 92 additions and 98 deletions

View File

@@ -23,7 +23,7 @@ type Plugin interface {
Quit() error // quit plugin
}
func Init(path string) (Plugin, error) {
func Init(path string, logOn bool) (Plugin, error) {
if path == "" {
return nil, nil
}
@@ -34,7 +34,9 @@ func Init(path string) (Plugin, error) {
pluginPath, err := locateFile(path, hashicorpGoPluginFile)
if err == nil {
// found hashicorp go plugin file
plugin = &HashicorpPlugin{}
plugin = &HashicorpPlugin{
logOn: logOn,
}
err = plugin.Init(pluginPath)
return plugin, err
}