refactor(log): replace log.Critical with log.Error (#37624)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: wxiaoguang <2114189+wxiaoguang@users.noreply.github.com>
This commit is contained in:
Copilot
2026-05-09 16:32:49 +00:00
committed by GitHub
parent 093c9e8ee6
commit 0a3aaeafe7
11 changed files with 13 additions and 17 deletions
+1 -1
View File
@@ -72,7 +72,7 @@ func initOAuth2Sources(ctx context.Context) error {
}
err := oauth2Source.RegisterSource()
if err != nil {
log.Critical("Unable to register source: %s due to Error: %v.", source.Name, err)
log.Error("Unable to register source: %s due to Error: %v.", source.Name, err)
}
}
return nil
+1 -1
View File
@@ -90,7 +90,7 @@ func UserHiddenCommentTypesFromRequest(ctx *context.Context) *big.Int {
func IsUserHiddenCommentTypeGroupChecked(group string, hiddenCommentTypes *big.Int) (ret bool) {
commentTypes, ok := hiddenCommentTypeGroups[group]
if !ok {
log.Critical("the group map for hidden comment types is out of sync, unknown group: %v", group)
log.Error("the group map for hidden comment types is out of sync, unknown group: %v", group)
return false
}
if hiddenCommentTypes == nil {
+2 -2
View File
@@ -120,7 +120,7 @@ func transferOwnership(ctx context.Context, doer *user_model.User, newOwnerName
if repoRenamed {
oldRelativePath, newRelativePath := repo_model.RelativePath(newOwnerName, repo.Name), repo_model.RelativePath(oldOwnerName, repo.Name)
if err := gitrepo.RenameRepository(ctx, repo_model.StorageRepo(oldRelativePath), repo_model.StorageRepo(newRelativePath)); err != nil {
log.Critical("Unable to move repository %s/%s directory from %s back to correct place %s: %v", oldOwnerName, repo.Name,
log.Error("Unable to move repository %s/%s directory from %s back to correct place %s: %v", oldOwnerName, repo.Name,
oldRelativePath, newRelativePath, err)
}
}
@@ -128,7 +128,7 @@ func transferOwnership(ctx context.Context, doer *user_model.User, newOwnerName
if wikiRenamed {
oldRelativePath, newRelativePath := repo_model.RelativeWikiPath(newOwnerName, repo.Name), repo_model.RelativeWikiPath(oldOwnerName, repo.Name)
if err := gitrepo.RenameRepository(ctx, repo_model.StorageRepo(oldRelativePath), repo_model.StorageRepo(newRelativePath)); err != nil {
log.Critical("Unable to move wiki for repository %s/%s directory from %s back to correct place %s: %v", oldOwnerName, repo.Name,
log.Error("Unable to move wiki for repository %s/%s directory from %s back to correct place %s: %v", oldOwnerName, repo.Name,
oldRelativePath, newRelativePath, err)
}
}
+1 -1
View File
@@ -45,7 +45,7 @@ func runMigrateTask(ctx context.Context, t *admin_model.Task) (err error) {
defer func(ctx context.Context) {
if e := recover(); e != nil {
err = fmt.Errorf("PANIC whilst trying to do migrate task: %v", e)
log.Critical("PANIC during runMigrateTask[%d] by DoerID[%d] to RepoID[%d] for OwnerID[%d]: %v\nStacktrace: %v", t.ID, t.DoerID, t.RepoID, t.OwnerID, e, log.Stack(2))
log.Error("PANIC during runMigrateTask[%d] by DoerID[%d] to RepoID[%d] for OwnerID[%d]: %v\nStacktrace: %v", t.ID, t.DoerID, t.RepoID, t.OwnerID, e, log.Stack(2))
}
if err == nil {
err = admin_model.FinishMigrateTask(ctx, t)
+1 -1
View File
@@ -108,7 +108,7 @@ func RenameUser(ctx context.Context, u *user_model.User, newUserName string, doe
u.Name = oldUserName
u.LowerName = strings.ToLower(oldUserName)
if err2 := util.Rename(user_model.UserPath(newUserName), user_model.UserPath(oldUserName)); err2 != nil && !os.IsNotExist(err2) {
log.Critical("Unable to rollback directory change during failed username change from: %s to: %s. DB Error: %v. Filesystem Error: %v", oldUserName, newUserName, err, err2)
log.Error("Unable to rollback directory change during failed username change from: %s to: %s. DB Error: %v. Filesystem Error: %v", oldUserName, newUserName, err, err2)
return fmt.Errorf("failed to rollback directory change during failed username change from: %s to: %s. DB Error: %w. Filesystem Error: %v", oldUserName, newUserName, err, err2)
}
return err