Bladeren bron

log: 添加webhook日志记录

370774330@qq.com 5 jaren geleden
bovenliggende
commit
2fb1a799ad
1 gewijzigde bestanden met toevoegingen van 6 en 1 verwijderingen
  1. 6 1
      web/src/main/java/cn/seecoder/web/controller/gitlab/CommitController.java

+ 6 - 1
web/src/main/java/cn/seecoder/web/controller/gitlab/CommitController.java

@@ -15,6 +15,7 @@ import com.nju.edu.gitlab.SeecoderGitlabApi;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -27,6 +28,7 @@ import java.util.List;
  */
 @Api(tags = "GitLab Hook API")
 @RestController
+@Slf4j
 public class CommitController {
 
     private final BugListService bugListService;
@@ -77,21 +79,24 @@ public class CommitController {
         for (GitWebHookVO.Commit commit: gitWebHookVO.getCommits()){
             if (commitService.isResolved(commit.getId())){
                 //已经解析过了
+                log.info("Commits 已经解析过了, id: {}", commit.getId());
                 continue;
             }
             CommitRule rule = CommitResolver.resolve(commit.getTitle());
             if (rule == null){
-                //不符合规范
+                log.info("Commits 不符合规范, id: {}", commit.getId());
                 continue;
             }
             switch (rule.getType()){
                 case FEAT:
                     treeNodeService.updateNodeState(rule.getId(),rule.getState());
                     commitService.save(new CommitPO(commit,projectId, CommitRelatedEnum.BUG_ID, rule.getId()));
+                    log.info("Commits 关联tree节点, id: {}", commit.getId());
                     break;
                 case FIX:
                     bugListService.updateState(rule.getState(), rule.getId());
                     commitService.save(new CommitPO(commit,projectId, CommitRelatedEnum.BUG_ID, rule.getId()));
+                    log.info("Commits 关联bug节点, id: {}", commit.getId());
                     break;
                 case UNKNOWN:
                     break;