Skip to content

Commit c522b5a

Browse files
authored
Merge pull request #92 from daniel-hutao/dev-1
fix: #89 #90 - logs format improved
2 parents c3b045a + 505ab80 commit c522b5a

File tree

7 files changed

+13
-14
lines changed

7 files changed

+13
-14
lines changed

cmd/argocd/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package main
22

33
import (
4-
"fmt"
4+
"log"
55

66
"github.com/merico-dev/stream/internal/pkg/argocd"
77
)
@@ -31,5 +31,5 @@ func (p Plugin) Uninstall(options *map[string]interface{}) (bool, error) {
3131
var DevStreamPlugin Plugin
3232

3333
func main() {
34-
fmt.Printf("%T: %s is a plugin for DevStream. Use it with DevStream.\n", NAME, DevStreamPlugin)
34+
log.Printf("%T: %s is a plugin for DevStream. Use it with DevStream.\n", NAME, DevStreamPlugin)
3535
}

cmd/argocdapp/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package main
22

33
import (
4-
"fmt"
4+
"log"
55

66
"github.com/merico-dev/stream/internal/pkg/argocdapp"
77
)
@@ -31,5 +31,5 @@ func (p Plugin) Uninstall(options *map[string]interface{}) (bool, error) {
3131
var DevStreamPlugin Plugin
3232

3333
func main() {
34-
fmt.Printf("%T: %s is a plugin for DevStream. Use it with DevStream.\n", NAME, DevStreamPlugin)
34+
log.Printf("%T: %s is a plugin for DevStream. Use it with DevStream.\n", NAME, DevStreamPlugin)
3535
}

cmd/devstream/init.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@ func initCMDFunc(cmd *cobra.Command, args []string) {
2323
log.Printf("Error: %s", err)
2424
return
2525
}
26+
log.Println("=== initialize finished ===")
2627
}

cmd/githubactions/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package main
22

33
import (
4-
"fmt"
4+
"log"
55

66
"github.com/merico-dev/stream/internal/pkg/githubactions"
77
)
@@ -31,5 +31,5 @@ func (p Plugin) Uninstall(options *map[string]interface{}) (bool, error) {
3131
var DevStreamPlugin Plugin
3232

3333
func main() {
34-
fmt.Printf("%T: %s is a plugin for DevStream. Use it with DevStream.\n", NAME, DevStreamPlugin)
34+
log.Printf("%T: %s is a plugin for DevStream. Use it with DevStream.\n", NAME, DevStreamPlugin)
3535
}

internal/pkg/pluginengine/plugin.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,20 +46,17 @@ func loadPlugin(tool *configloader.Tool) (DevStreamPlugin, error) {
4646
mod := fmt.Sprintf("plugins/%s_%s.so", tool.Name, tool.Version)
4747
plug, err := plugin.Open(mod)
4848
if err != nil {
49-
fmt.Println(err)
5049
return nil, err
5150
}
5251

5352
var devStreamPlugin DevStreamPlugin
5453
symDevStreamPlugin, err := plug.Lookup("DevStreamPlugin")
5554
if err != nil {
56-
fmt.Println(err)
5755
return nil, err
5856
}
5957

6058
devStreamPlugin, ok := symDevStreamPlugin.(DevStreamPlugin)
6159
if !ok {
62-
fmt.Println(err)
6360
return nil, err
6461
}
6562

internal/pkg/pluginmanager/manager.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@ func DownloadPlugins(conf *configloader.Config) error {
2020
pluginFileName := configloader.GetPluginFileName(&tool)
2121
if _, err := os.Stat(filepath.Join(pluginsDir, pluginFileName)); errors.Is(err, os.ErrNotExist) {
2222
// plugin does not exist
23-
log.Printf("=== now downloading plugin: %s ,version: %s === \n", pluginFileName, tool.Version)
23+
log.Printf("=== now downloading plugin: %s, version: %s ===", pluginFileName, tool.Version)
2424
err := dc.download(pluginsDir, pluginFileName, tool.Version)
2525
if err != nil {
2626
return err
2727
}
28-
log.Printf("=== plugin: %s ,version: %s downloaded === \n", pluginFileName, tool.Version)
28+
log.Printf("=== plugin: %s, version: %s downloaded ===", pluginFileName, tool.Version)
2929
}
30+
log.Printf("=== plugin: %s, version: %s is exists ===", pluginFileName, tool.Version)
3031
}
3132

3233
return nil

internal/pkg/statemanager/state.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ const (
1515
StatusUninstalled ComponentStatus = "uninstalled"
1616
// We use StatusInstalled when a plugin is installed but we don't know its status is "running" or "failed".
1717
// For example: We try to uninstall a plugin but failed for some reason.
18-
StatusInstalled ComponentStatus = "installed"
19-
StatusRunning ComponentStatus = "running"
20-
StatusFailed ComponentStatus = "failed"
18+
StatusInstalled ComponentStatus = "installed"
19+
StatusRunning ComponentStatus = "running"
20+
StatusFailed ComponentStatus = "failed"
2121
)
2222

2323
const (

0 commit comments

Comments
 (0)