use logger.Warning instead of fmt.Printf at loading plugins (#629)

This commit is contained in:
yubo 2021-03-23 18:37:03 +08:00 committed by GitHub
parent 30b469ddbd
commit be9d6ac660
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -6,6 +6,8 @@ import (
"path/filepath"
"plugin"
"strings"
"github.com/toolkits/pkg/logger"
)
const pluginDir = "plugins"
@ -13,14 +15,14 @@ const pluginDir = "plugins"
func init() {
plugins, err := listPlugins(pluginDir)
if err != nil {
fmt.Printf("list plugins: \n", err)
logger.Warningf("list plugins: %s", err)
return
}
for _, file := range plugins {
_, err := plugin.Open(file)
if err != nil {
fmt.Printf("plugin.Open %s err %s\n", file, err)
logger.Warningf("plugin.Open %s err %s", file, err)
continue
}
}