use logger.Warning instead of fmt.Printf at loading plugins (#629)
This commit is contained in:
parent
30b469ddbd
commit
be9d6ac660
|
@ -6,6 +6,8 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"plugin"
|
"plugin"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/toolkits/pkg/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
const pluginDir = "plugins"
|
const pluginDir = "plugins"
|
||||||
|
@ -13,14 +15,14 @@ const pluginDir = "plugins"
|
||||||
func init() {
|
func init() {
|
||||||
plugins, err := listPlugins(pluginDir)
|
plugins, err := listPlugins(pluginDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("list plugins: \n", err)
|
logger.Warningf("list plugins: %s", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, file := range plugins {
|
for _, file := range plugins {
|
||||||
_, err := plugin.Open(file)
|
_, err := plugin.Open(file)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("plugin.Open %s err %s\n", file, err)
|
logger.Warningf("plugin.Open %s err %s", file, err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue