You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by ab...@apache.org on 2024/03/14 13:54:33 UTC

(incubator-devlake) branch release-v0.21 updated: Morelog (#7173)

This is an automated email from the ASF dual-hosted git repository.

abeizn pushed a commit to branch release-v0.21
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/release-v0.21 by this push:
     new c18dfcf7c Morelog (#7173)
c18dfcf7c is described below

commit c18dfcf7c9ce5b30ee0e2d7c8f8e42ddc0416e17
Author: Lynwee <li...@merico.dev>
AuthorDate: Thu Mar 14 21:54:29 2024 +0800

    Morelog (#7173)
    
    * fix(helper): add more log
    
    * fix(helper): add more log
    
    ---------
    
    Co-authored-by: houlinwei <ti...@gmail.com>
---
 backend/core/plugin/hub.go                         |  3 +++
 .../helpers/pluginhelper/api/connection_helper.go  | 22 +++++++++++-----------
 backend/plugins/jira/api/connection_api.go         |  4 ++++
 backend/plugins/jira/api/init.go                   |  1 +
 backend/plugins/jira/impl/impl.go                  |  2 +-
 5 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/backend/core/plugin/hub.go b/backend/core/plugin/hub.go
index 6788c9057..a7f9c9f2c 100644
--- a/backend/core/plugin/hub.go
+++ b/backend/core/plugin/hub.go
@@ -74,10 +74,13 @@ func FindPluginNameBySubPkgPath(subPkgPath string) (string, errors.Error) {
 
 func InitPlugins(basicRes context.BasicRes) {
 	for pluginName, pluginMeta := range plugins {
+		basicRes.GetLogger().Info("try to init plugin: %s", pluginName)
 		if pluginEntry, ok := pluginMeta.(PluginInit); ok {
 			err := pluginEntry.Init(basicRes)
 			if err != nil {
 				panic(fmt.Errorf("failed to initialize plugin %v due to %w", pluginName, err))
+			} else {
+				basicRes.GetLogger().Info("init plugin: %s done", pluginName)
 			}
 		} else {
 			basicRes.GetLogger().Info("plugin: %s doesn't implement 'PluginInit', it will be skipped.", pluginName)
diff --git a/backend/helpers/pluginhelper/api/connection_helper.go b/backend/helpers/pluginhelper/api/connection_helper.go
index 7be0395a3..677f350bc 100644
--- a/backend/helpers/pluginhelper/api/connection_helper.go
+++ b/backend/helpers/pluginhelper/api/connection_helper.go
@@ -127,22 +127,22 @@ func (c *ConnectionApiHelper) FirstById(connection interface{}, id uint64) error
 
 // List returns all connections with password/token decrypted
 func (c *ConnectionApiHelper) List(connections interface{}) errors.Error {
-	c.log.Info("connections :%+v", connections)
-	fmt.Printf("connections :%+v\n", connections)
-	c.log.Info("connection api helper :%+v", c)
-	fmt.Printf("connection api helper :%+v\n", c)
 	if c == nil {
 		c.log.Info("connection api helper is nil")
-		fmt.Printf("connection api helper is nil")
+		fmt.Printf("connection api helper is nil\n")
 	} else {
-		c.log.Info("connection api helper is not nil")
-		fmt.Printf("connection api helper is not nil")
+		c.log.Info("%s, connections :%+v", c.pluginName, connections)
+		fmt.Printf("%s connections :%+v\n", c.pluginName, connections)
+		c.log.Info("%s connection api helper :%+v", c.pluginName, c)
+		fmt.Printf("%s connection api helper :%+v\n", c.pluginName, c)
+		c.log.Info("%s connection api helper is not nil", c.pluginName)
+		fmt.Printf("%s connection api helper is not nil\n", c.pluginName)
 		if c.db == nil {
-			c.log.Info("connection api helper db is nil")
-			fmt.Println("connection api helper db is nil")
+			c.log.Info("%s connection api helper db is nil", c.pluginName)
+			fmt.Printf("%s connection api helper db is nil\n", c.pluginName)
 		} else {
-			c.log.Info("connection api helper db is not nil")
-			fmt.Println("connection api helper db is not nil")
+			c.log.Info("%s connection api helper db is not nil", c.pluginName)
+			fmt.Printf("%s connection api helper db is not nil", c.pluginName)
 		}
 	}
 
diff --git a/backend/plugins/jira/api/connection_api.go b/backend/plugins/jira/api/connection_api.go
index 9b6071b15..760a46b37 100644
--- a/backend/plugins/jira/api/connection_api.go
+++ b/backend/plugins/jira/api/connection_api.go
@@ -206,6 +206,10 @@ func DeleteConnection(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput
 // @Failure 500  {string} errcode.Error "Internal Error"
 // @Router /plugins/jira/connections [GET]
 func ListConnections(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput, errors.Error) {
+	basicRes.GetLogger().Info("ds helper %+v", dsHelper)
+	if dsHelper != nil {
+		basicRes.GetLogger().Info("ds helper dsHelper %+v", dsHelper.ConnApi)
+	}
 	return dsHelper.ConnApi.GetAll(input)
 }
 
diff --git a/backend/plugins/jira/api/init.go b/backend/plugins/jira/api/init.go
index 86ca5caa4..34a26228e 100644
--- a/backend/plugins/jira/api/init.go
+++ b/backend/plugins/jira/api/init.go
@@ -50,6 +50,7 @@ func Init(br context.BasicRes, p plugin.PluginMeta) {
 		nil,
 		nil,
 	)
+	basicRes.GetLogger().Info("init dshelper: %+v", dsHelper)
 	raProxy = api.NewDsRemoteApiProxyHelper[models.JiraConnection](dsHelper.ConnApi.ModelApiHelper)
 	raScopeList = api.NewDsRemoteApiScopeListHelper[models.JiraConnection, models.JiraBoard, JiraRemotePagination](raProxy, listJiraRemoteScopes)
 	raScopeSearch = api.NewDsRemoteApiScopeSearchHelper[models.JiraConnection, models.JiraBoard](raProxy, searchJiraRemoteBoards)
diff --git a/backend/plugins/jira/impl/impl.go b/backend/plugins/jira/impl/impl.go
index 259361475..542a2e05b 100644
--- a/backend/plugins/jira/impl/impl.go
+++ b/backend/plugins/jira/impl/impl.go
@@ -62,7 +62,7 @@ func (p Jira) ScopeConfig() dal.Tabler {
 
 func (p Jira) Init(basicRes context.BasicRes) errors.Error {
 	api.Init(basicRes, p)
-
+	fmt.Println("init jira with basic res and p", basicRes, p)
 	return nil
 }