summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
Diffstat (limited to 'models')
-rw-r--r--models/action.go20
-rw-r--r--models/admin.go2
-rw-r--r--models/branches.go10
-rw-r--r--models/gpg_key.go12
-rw-r--r--models/issue.go26
-rw-r--r--models/issue_assignees.go4
-rw-r--r--models/issue_comment.go30
-rw-r--r--models/issue_mail.go2
-rw-r--r--models/issue_milestone.go4
-rw-r--r--models/lfs_lock.go4
-rw-r--r--models/mail.go10
-rw-r--r--models/migrations/migrations.go4
-rw-r--r--models/migrations/v33.go2
-rw-r--r--models/migrations/v45.go2
-rw-r--r--models/migrations/v50.go2
-rw-r--r--models/migrations/v61.go2
-rw-r--r--models/org.go2
-rw-r--r--models/org_team.go2
-rw-r--r--models/pull.go76
-rw-r--r--models/release.go8
-rw-r--r--models/repo.go64
-rw-r--r--models/repo_indexer.go6
-rw-r--r--models/repo_mirror.go54
-rw-r--r--models/ssh_key.go2
-rw-r--r--models/status.go2
-rw-r--r--models/u2f.go2
-rw-r--r--models/update.go2
-rw-r--r--models/user.go28
-rw-r--r--models/webhook.go26
29 files changed, 205 insertions, 205 deletions
diff --git a/models/action.go b/models/action.go
index d4cc4086db..e496166c42 100644
--- a/models/action.go
+++ b/models/action.go
@@ -110,7 +110,7 @@ func (a *Action) loadActUser() {
} else if IsErrUserNotExist(err) {
a.ActUser = NewGhostUser()
} else {
- log.Error(4, "GetUserByID(%d): %v", a.ActUserID, err)
+ log.Error("GetUserByID(%d): %v", a.ActUserID, err)
}
}
@@ -121,7 +121,7 @@ func (a *Action) loadRepo() {
var err error
a.Repo, err = GetRepositoryByID(a.RepoID)
if err != nil {
- log.Error(4, "GetRepositoryByID(%d): %v", a.RepoID, err)
+ log.Error("GetRepositoryByID(%d): %v", a.RepoID, err)
}
}
@@ -256,7 +256,7 @@ func (a *Action) GetIssueTitle() string {
index := com.StrTo(a.GetIssueInfos()[0]).MustInt64()
issue, err := GetIssueByIndex(a.RepoID, index)
if err != nil {
- log.Error(4, "GetIssueByIndex: %v", err)
+ log.Error("GetIssueByIndex: %v", err)
return "500 when get issue"
}
return issue.Title
@@ -268,7 +268,7 @@ func (a *Action) GetIssueContent() string {
index := com.StrTo(a.GetIssueInfos()[0]).MustInt64()
issue, err := GetIssueByIndex(a.RepoID, index)
if err != nil {
- log.Error(4, "GetIssueByIndex: %v", err)
+ log.Error("GetIssueByIndex: %v", err)
return "500 when get issue"
}
return issue.Content
@@ -419,7 +419,7 @@ func (pc *PushCommits) AvatarLink(email string) string {
if err != nil {
pc.avatars[email] = base.AvatarLink(email)
if !IsErrUserNotExist(err) {
- log.Error(4, "GetUserByEmail: %v", err)
+ log.Error("GetUserByEmail: %v", err)
return ""
}
} else {
@@ -619,7 +619,7 @@ func CommitRepoAction(opts CommitRepoActionOptions) error {
}
if err = UpdateIssuesCommit(pusher, repo, opts.Commits.Commits, refName); err != nil {
- log.Error(4, "updateIssuesCommit: %v", err)
+ log.Error("updateIssuesCommit: %v", err)
}
}
@@ -661,12 +661,12 @@ func CommitRepoAction(opts CommitRepoActionOptions) error {
if isNewBranch {
gitRepo, err := git.OpenRepository(repo.RepoPath())
if err != nil {
- log.Error(4, "OpenRepository[%s]: %v", repo.RepoPath(), err)
+ log.Error("OpenRepository[%s]: %v", repo.RepoPath(), err)
}
shaSum, err = gitRepo.GetBranchCommitID(refName)
if err != nil {
- log.Error(4, "GetBranchCommitID[%s]: %v", opts.RefFullName, err)
+ log.Error("GetBranchCommitID[%s]: %v", opts.RefFullName, err)
}
if err = PrepareWebhooks(repo, HookEventCreate, &api.CreatePayload{
Ref: refName,
@@ -697,11 +697,11 @@ func CommitRepoAction(opts CommitRepoActionOptions) error {
gitRepo, err := git.OpenRepository(repo.RepoPath())
if err != nil {
- log.Error(4, "OpenRepository[%s]: %v", repo.RepoPath(), err)
+ log.Error("OpenRepository[%s]: %v", repo.RepoPath(), err)
}
shaSum, err = gitRepo.GetTagCommitID(refName)
if err != nil {
- log.Error(4, "GetTagCommitID[%s]: %v", opts.RefFullName, err)
+ log.Error("GetTagCommitID[%s]: %v", opts.RefFullName, err)
}
if err = PrepareWebhooks(repo, HookEventCreate, &api.CreatePayload{
Ref: refName,
diff --git a/models/admin.go b/models/admin.go
index 275fff2773..f75428ad4e 100644
--- a/models/admin.go
+++ b/models/admin.go
@@ -65,7 +65,7 @@ func removeAllWithNotice(e Engine, title, path string) {
desc := fmt.Sprintf("%s [%s]: %v", title, path, err)
log.Warn(desc)
if err = createNotice(e, NoticeRepository, desc); err != nil {
- log.Error(4, "CreateRepositoryNotice: %v", err)
+ log.Error("CreateRepositoryNotice: %v", err)
}
}
}
diff --git a/models/branches.go b/models/branches.go
index 08ab2c5b03..abefa60f48 100644
--- a/models/branches.go
+++ b/models/branches.go
@@ -61,7 +61,7 @@ func (protectBranch *ProtectedBranch) CanUserPush(userID int64) bool {
in, err := IsUserInTeams(userID, protectBranch.WhitelistTeamIDs)
if err != nil {
- log.Error(1, "IsUserInTeams:", err)
+ log.Error("IsUserInTeams: %v", err)
return false
}
return in
@@ -83,7 +83,7 @@ func (protectBranch *ProtectedBranch) CanUserMerge(userID int64) bool {
in, err := IsUserInTeams(userID, protectBranch.MergeWhitelistTeamIDs)
if err != nil {
- log.Error(1, "IsUserInTeams:", err)
+ log.Error("IsUserInTeams: %v", err)
return false
}
return in
@@ -101,7 +101,7 @@ func (protectBranch *ProtectedBranch) HasEnoughApprovals(pr *PullRequest) bool {
func (protectBranch *ProtectedBranch) GetGrantedApprovalsCount(pr *PullRequest) int64 {
reviews, err := GetReviewersByPullID(pr.Issue.ID)
if err != nil {
- log.Error(1, "GetReviewersByPullID:", err)
+ log.Error("GetReviewersByPullID: %v", err)
return 0
}
@@ -119,7 +119,7 @@ func (protectBranch *ProtectedBranch) GetGrantedApprovalsCount(pr *PullRequest)
}
approvalTeamCount, err := UsersInTeamsCount(userIDs, protectBranch.ApprovalsWhitelistTeamIDs)
if err != nil {
- log.Error(1, "UsersInTeamsCount:", err)
+ log.Error("UsersInTeamsCount: %v", err)
return 0
}
return approvalTeamCount + approvals
@@ -466,6 +466,6 @@ func RemoveOldDeletedBranches() {
deleteBefore := time.Now().Add(-setting.Cron.DeletedBranchesCleanup.OlderThan)
_, err := x.Where("deleted_unix < ?", deleteBefore.Unix()).Delete(new(DeletedBranch))
if err != nil {
- log.Error(4, "DeletedBranchesCleanup: %v", err)
+ log.Error("DeletedBranchesCleanup: %v", err)
}
}
diff --git a/models/gpg_key.go b/models/gpg_key.go
index 03b0fd0f69..0352456e54 100644
--- a/models/gpg_key.go
+++ b/models/gpg_key.go
@@ -52,7 +52,7 @@ func (key *GPGKey) BeforeInsert() {
func (key *GPGKey) AfterLoad(session *xorm.Session) {
err := session.Where("primary_key_id=?", key.KeyID).Find(&key.SubsKey)
if err != nil {
- log.Error(3, "Find Sub GPGkeys[%d]: %v", key.KeyID, err)
+ log.Error("Find Sub GPGkeys[%s]: %v", key.KeyID, err)
}
}
@@ -364,7 +364,7 @@ func ParseCommitWithSignature(c *git.Commit) *CommitVerification {
//Parsing signature
sig, err := extractSignature(c.Signature.Signature)
if err != nil { //Skipping failed to extract sign
- log.Error(3, "SignatureRead err: %v", err)
+ log.Error("SignatureRead err: %v", err)
return &CommitVerification{
Verified: false,
Reason: "gpg.error.extract_sign",
@@ -377,7 +377,7 @@ func ParseCommitWithSignature(c *git.Commit) *CommitVerification {
// We can expect this to often be an ErrUserNotExist. in the case
// it is not, however, it is important to log it.
if !IsErrUserNotExist(err) {
- log.Error(3, "GetUserByEmail: %v", err)
+ log.Error("GetUserByEmail: %v", err)
}
return &CommitVerification{
Verified: false,
@@ -387,7 +387,7 @@ func ParseCommitWithSignature(c *git.Commit) *CommitVerification {
keys, err := ListGPGKeys(committer.ID)
if err != nil { //Skipping failed to get gpg keys of user
- log.Error(3, "ListGPGKeys: %v", err)
+ log.Error("ListGPGKeys: %v", err)
return &CommitVerification{
Verified: false,
Reason: "gpg.error.failed_retrieval_gpg_keys",
@@ -411,7 +411,7 @@ func ParseCommitWithSignature(c *git.Commit) *CommitVerification {
//Generating hash of commit
hash, err := populateHash(sig.Hash, []byte(c.Signature.Payload))
if err != nil { //Skipping ailed to generate hash
- log.Error(3, "PopulateHash: %v", err)
+ log.Error("PopulateHash: %v", err)
return &CommitVerification{
Verified: false,
Reason: "gpg.error.generate_hash",
@@ -432,7 +432,7 @@ func ParseCommitWithSignature(c *git.Commit) *CommitVerification {
//Generating hash of commit
hash, err := populateHash(sig.Hash, []byte(c.Signature.Payload))
if err != nil { //Skipping ailed to generate hash
- log.Error(3, "PopulateHash: %v", err)
+ log.Error("PopulateHash: %v", err)
return &CommitVerification{
Verified: false,
Reason: "gpg.error.generate_hash",
diff --git a/models/issue.go b/models/issue.go
index 8a6b20727a..753345d38f 100644
--- a/models/issue.go
+++ b/models/issue.go
@@ -112,7 +112,7 @@ func (issue *Issue) IsTimetrackerEnabled() bool {
func (issue *Issue) isTimetrackerEnabled(e Engine) bool {
if err := issue.loadRepo(e); err != nil {
- log.Error(4, fmt.Sprintf("loadRepo: %v", err))
+ log.Error(fmt.Sprintf("loadRepo: %v", err))
return false
}
return issue.Repo.IsTimetrackerEnabled()
@@ -423,23 +423,23 @@ func (issue *Issue) sendLabelUpdatedWebhook(doer *User) {
var err error
if err = issue.loadRepo(x); err != nil {
- log.Error(4, "loadRepo: %v", err)
+ log.Error("loadRepo: %v", err)
return
}
if err = issue.loadPoster(x); err != nil {
- log.Error(4, "loadPoster: %v", err)
+ log.Error("loadPoster: %v", err)
return
}
mode, _ := AccessLevel(issue.Poster, issue.Repo)
if issue.IsPull {
if err = issue.loadPullRequest(x); err != nil {
- log.Error(4, "loadPullRequest: %v", err)
+ log.Error("loadPullRequest: %v", err)
return
}
if err = issue.PullRequest.LoadIssue(); err != nil {
- log.Error(4, "LoadIssue: %v", err)
+ log.Error("LoadIssue: %v", err)
return
}
err = PrepareWebhooks(issue.Repo, HookEventPullRequest, &api.PullRequestPayload{
@@ -459,7 +459,7 @@ func (issue *Issue) sendLabelUpdatedWebhook(doer *User) {
})
}
if err != nil {
- log.Error(4, "PrepareWebhooks [is_pull: %v]: %v", issue.IsPull, err)
+ log.Error("PrepareWebhooks [is_pull: %v]: %v", issue.IsPull, err)
} else {
go HookQueue.Add(issue.RepoID)
}
@@ -584,7 +584,7 @@ func (issue *Issue) ClearLabels(doer *User) (err error) {
if issue.IsPull {
err = issue.PullRequest.LoadIssue()
if err != nil {
- log.Error(4, "LoadIssue: %v", err)
+ log.Error("LoadIssue: %v", err)
return
}
err = PrepareWebhooks(issue.Repo, HookEventPullRequest, &api.PullRequestPayload{
@@ -604,7 +604,7 @@ func (issue *Issue) ClearLabels(doer *User) (err error) {
})
}
if err != nil {
- log.Error(4, "PrepareWebhooks [is_pull: %v]: %v", issue.IsPull, err)
+ log.Error("PrepareWebhooks [is_pull: %v]: %v", issue.IsPull, err)
} else {
go HookQueue.Add(issue.RepoID)
}
@@ -819,7 +819,7 @@ func (issue *Issue) ChangeStatus(doer *User, isClosed bool) (err error) {
err = PrepareWebhooks(issue.Repo, HookEventIssues, apiIssue)
}
if err != nil {
- log.Error(4, "PrepareWebhooks [is_pull: %v, is_closed: %v]: %v", issue.IsPull, isClosed, err)
+ log.Error("PrepareWebhooks [is_pull: %v, is_closed: %v]: %v", issue.IsPull, isClosed, err)
} else {
go HookQueue.Add(issue.Repo.ID)
}
@@ -888,7 +888,7 @@ func (issue *Issue) ChangeTitle(doer *User, title string) (err error) {
}
if err != nil {
- log.Error(4, "PrepareWebhooks [is_pull: %v]: %v", issue.IsPull, err)
+ log.Error("PrepareWebhooks [is_pull: %v]: %v", issue.IsPull, err)
} else {
go HookQueue.Add(issue.RepoID)
}
@@ -953,7 +953,7 @@ func (issue *Issue) ChangeContent(doer *User, content string) (err error) {
})
}
if err != nil {
- log.Error(4, "PrepareWebhooks [is_pull: %v]: %v", issue.IsPull, err)
+ log.Error("PrepareWebhooks [is_pull: %v]: %v", issue.IsPull, err)
} else {
go HookQueue.Add(issue.RepoID)
}
@@ -1169,7 +1169,7 @@ func NewIssue(repo *Repository, issue *Issue, labelIDs []int64, assigneeIDs []in
Repo: repo,
IsPrivate: repo.IsPrivate,
}); err != nil {
- log.Error(4, "NotifyWatchers: %v", err)
+ log.Error("NotifyWatchers: %v", err)
}
mode, _ := AccessLevel(issue.Poster, issue.Repo)
@@ -1180,7 +1180,7 @@ func NewIssue(repo *Repository, issue *Issue, labelIDs []int64, assigneeIDs []in
Repository: repo.APIFormat(mode),
Sender: issue.Poster.APIFormat(),
}); err != nil {
- log.Error(4, "PrepareWebhooks: %v", err)
+ log.Error("PrepareWebhooks: %v", err)
} else {
go HookQueue.Add(issue.RepoID)
}
diff --git a/models/issue_assignees.go b/models/issue_assignees.go
index 1ac1e276cd..5806dd976d 100644
--- a/models/issue_assignees.go
+++ b/models/issue_assignees.go
@@ -187,7 +187,7 @@ func (issue *Issue) changeAssignee(sess *xorm.Session, doer *User, assigneeID in
apiPullRequest.Action = api.HookIssueAssigned
}
if err := prepareWebhooks(sess, issue.Repo, HookEventPullRequest, apiPullRequest); err != nil {
- log.Error(4, "PrepareWebhooks [is_pull: %v, remove_assignee: %v]: %v", issue.IsPull, removed, err)
+ log.Error("PrepareWebhooks [is_pull: %v, remove_assignee: %v]: %v", issue.IsPull, removed, err)
return nil
}
} else {
@@ -205,7 +205,7 @@ func (issue *Issue) changeAssignee(sess *xorm.Session, doer *User, assigneeID in
apiIssue.Action = api.HookIssueAssigned
}
if err := prepareWebhooks(sess, issue.Repo, HookEventIssues, apiIssue); err != nil {
- log.Error(4, "PrepareWebhooks [is_pull: %v, remove_assignee: %v]: %v", issue.IsPull, removed, err)
+ log.Error("PrepareWebhooks [is_pull: %v, remove_assignee: %v]: %v", issue.IsPull, removed, err)
return nil
}
}
diff --git a/models/issue_comment.go b/models/issue_comment.go
index d4a3d26a78..360f5a6594 100644
--- a/models/issue_comment.go
+++ b/models/issue_comment.go
@@ -171,12 +171,12 @@ func (c *Comment) AfterDelete() {
func (c *Comment) HTMLURL() string {
err := c.LoadIssue()
if err != nil { // Silently dropping errors :unamused:
- log.Error(4, "LoadIssue(%d): %v", c.IssueID, err)
+ log.Error("LoadIssue(%d): %v", c.IssueID, err)
return ""
}
err = c.Issue.loadRepo(x)
if err != nil { // Silently dropping errors :unamused:
- log.Error(4, "loadRepo(%d): %v", c.Issue.RepoID, err)
+ log.Error("loadRepo(%d): %v", c.Issue.RepoID, err)
return ""
}
if c.Type == CommentTypeCode {
@@ -200,7 +200,7 @@ func (c *Comment) HTMLURL() string {
func (c *Comment) IssueURL() string {
err := c.LoadIssue()
if err != nil { // Silently dropping errors :unamused:
- log.Error(4, "LoadIssue(%d): %v", c.IssueID, err)
+ log.Error("LoadIssue(%d): %v", c.IssueID, err)
return ""
}
@@ -210,7 +210,7 @@ func (c *Comment) IssueURL() string {
err = c.Issue.loadRepo(x)
if err != nil { // Silently dropping errors :unamused:
- log.Error(4, "loadRepo(%d): %v", c.Issue.RepoID, err)
+ log.Error("loadRepo(%d): %v", c.Issue.RepoID, err)
return ""
}
return c.Issue.HTMLURL()
@@ -220,13 +220,13 @@ func (c *Comment) IssueURL() string {
func (c *Comment) PRURL() string {
err := c.LoadIssue()
if err != nil { // Silently dropping errors :unamused:
- log.Error(4, "LoadIssue(%d): %v", c.IssueID, err)
+ log.Error("LoadIssue(%d): %v", c.IssueID, err)
return ""
}
err = c.Issue.loadRepo(x)
if err != nil { // Silently dropping errors :unamused:
- log.Error(4, "loadRepo(%d): %v", c.Issue.RepoID, err)
+ log.Error("loadRepo(%d): %v", c.Issue.RepoID, err)
return ""
}
@@ -318,7 +318,7 @@ func (c *Comment) LoadPoster() error {
c.PosterID = -1
c.Poster = NewGhostUser()
} else {
- log.Error(3, "getUserByID[%d]: %v", c.ID, err)
+ log.Error("getUserByID[%d]: %v", c.ID, err)
}
}
return nil
@@ -333,7 +333,7 @@ func (c *Comment) LoadAttachments() error {
var err error
c.Attachments, err = getAttachmentsByCommentID(x, c.ID)
if err != nil {
- log.Error(3, "getAttachmentsByCommentID[%d]: %v", c.ID, err)
+ log.Error("getAttachmentsByCommentID[%d]: %v", c.ID, err)
}
return nil
}
@@ -384,7 +384,7 @@ func (c *Comment) mailParticipants(e Engine, opType ActionType, issue *Issue) (e
content = fmt.Sprintf("Reopened #%d", issue.Index)
}
if err = mailIssueCommentToParticipants(e, issue, c.Poster, content, c, mentions); err != nil {
- log.Error(4, "mailIssueCommentToParticipants: %v", err)
+ log.Error("mailIssueCommentToParticipants: %v", err)
}
return nil
@@ -492,12 +492,12 @@ func (c *Comment) MustAsDiff() *Diff {
func (c *Comment) CodeCommentURL() string {
err := c.LoadIssue()
if err != nil { // Silently dropping errors :unamused:
- log.Error(4, "LoadIssue(%d): %v", c.IssueID, err)
+ log.Error("LoadIssue(%d): %v", c.IssueID, err)
return ""
}
err = c.Issue.loadRepo(x)
if err != nil { // Silently dropping errors :unamused:
- log.Error(4, "loadRepo(%d): %v", c.Issue.RepoID, err)
+ log.Error("loadRepo(%d): %v", c.Issue.RepoID, err)
return ""
}
return fmt.Sprintf("%s/files#%s", c.Issue.HTMLURL(), c.HashTag())
@@ -638,7 +638,7 @@ func sendCreateCommentAction(e *xorm.Session, opts *CreateCommentOptions, commen
// Notify watchers for whatever action comes in, ignore if no action type.
if act.OpType > 0 {
if err = notifyWatchers(e, act); err != nil {
- log.Error(4, "notifyWatchers: %v", err)
+ log.Error("notifyWatchers: %v", err)
}
}
return nil
@@ -850,7 +850,7 @@ func CreateIssueComment(doer *User, repo *Repository, issue *Issue, content stri
Repository: repo.APIFormat(mode),
Sender: doer.APIFormat(),
}); err != nil {
- log.Error(2, "PrepareWebhooks [comment_id: %d]: %v", comment.ID, err)
+ log.Error("PrepareWebhooks [comment_id: %d]: %v", comment.ID, err)
} else {
go HookQueue.Add(repo.ID)
}
@@ -1053,7 +1053,7 @@ func UpdateComment(doer *User, c *Comment, oldContent string) error {
Repository: c.Issue.Repo.APIFormat(mode),
Sender: doer.APIFormat(),
}); err != nil {
- log.Error(2, "PrepareWebhooks [comment_id: %d]: %v", c.ID, err)
+ log.Error("PrepareWebhooks [comment_id: %d]: %v", c.ID, err)
} else {
go HookQueue.Add(c.Issue.Repo.ID)
}
@@ -1108,7 +1108,7 @@ func DeleteComment(doer *User, comment *Comment) error {
Repository: comment.Issue.Repo.APIFormat(mode),
Sender: doer.APIFormat(),
}); err != nil {
- log.Error(2, "PrepareWebhooks [comment_id: %d]: %v", comment.ID, err)
+ log.Error("PrepareWebhooks [comment_id: %d]: %v", comment.ID, err)
} else {
go HookQueue.Add(comment.Issue.Repo.ID)
}
diff --git a/models/issue_mail.go b/models/issue_mail.go
index 66ad46e39d..ec89edff36 100644
--- a/models/issue_mail.go
+++ b/models/issue_mail.go
@@ -129,7 +129,7 @@ func (issue *Issue) mailParticipants(e Engine) (err error) {
}
if err = mailIssueCommentToParticipants(e, issue, issue.Poster, issue.Content, nil, mentions); err != nil {
- log.Error(4, "mailIssueCommentToParticipants: %v", err)
+ log.Error("mailIssueCommentToParticipants: %v", err)
}
return nil
diff --git a/models/issue_milestone.go b/models/issue_milestone.go
index 6cb2b6b574..5304d85e97 100644
--- a/models/issue_milestone.go
+++ b/models/issue_milestone.go
@@ -393,7 +393,7 @@ func ChangeMilestoneAssign(issue *Issue, doer *User, oldMilestoneID int64) (err
if issue.IsPull {
err = issue.PullRequest.LoadIssue()
if err != nil {
- log.Error(2, "LoadIssue: %v", err)
+ log.Error("LoadIssue: %v", err)
return
}
err = PrepareWebhooks(issue.Repo, HookEventPullRequest, &api.PullRequestPayload{
@@ -413,7 +413,7 @@ func ChangeMilestoneAssign(issue *Issue, doer *User, oldMilestoneID int64) (err
})
}
if err != nil {
- log.Error(2, "PrepareWebhooks [is_pull: %v]: %v", issue.IsPull, err)
+ log.Error("PrepareWebhooks [is_pull: %v]: %v", issue.IsPull, err)
} else {
go HookQueue.Add(issue.RepoID)
}
diff --git a/models/lfs_lock.go b/models/lfs_lock.go
index 66fc2b2ec4..d12c7cb538 100644
--- a/models/lfs_lock.go
+++ b/models/lfs_lock.go
@@ -39,11 +39,11 @@ func (l *LFSLock) AfterLoad(session *xorm.Session) {
var err error
l.Owner, err = getUserByID(session, l.OwnerID)
if err != nil {
- log.Error(2, "LFS lock AfterLoad failed OwnerId[%d] not found: %v", l.OwnerID, err)
+ log.Error("LFS lock AfterLoad failed OwnerId[%d] not found: %v", l.OwnerID, err)
}
l.Repo, err = getRepositoryByID(session, l.RepoID)
if err != nil {
- log.Error(2, "LFS lock AfterLoad failed RepoId[%d] not found: %v", l.RepoID, err)
+ log.Error("LFS lock AfterLoad failed RepoId[%d] not found: %v", l.RepoID, err)
}
}
diff --git a/models/mail.go b/models/mail.go
index 7e6d4e0265..31ac4a3a5a 100644
--- a/models/mail.go
+++ b/models/mail.go
@@ -56,7 +56,7 @@ func SendUserMail(c *macaron.Context, u *User, tpl base.TplName, code, subject,
var content bytes.Buffer
if err := templates.ExecuteTemplate(&content, string(tpl), data); err != nil {
- log.Error(3, "Template: %v", err)
+ log.Error("Template: %v", err)
return
}
@@ -88,7 +88,7 @@ func SendActivateEmailMail(c *macaron.Context, u *User, email *EmailAddress) {
var content bytes.Buffer
if err := templates.ExecuteTemplate(&content, string(mailAuthActivateEmail), data); err != nil {
- log.Error(3, "Template: %v", err)
+ log.Error("Template: %v", err)
return
}
@@ -107,7 +107,7 @@ func SendRegisterNotifyMail(c *macaron.Context, u *User) {
var content bytes.Buffer
if err := templates.ExecuteTemplate(&content, string(mailAuthRegisterNotify), data); err != nil {
- log.Error(3, "Template: %v", err)
+ log.Error("Template: %v", err)
return
}
@@ -131,7 +131,7 @@ func SendCollaboratorMail(u, doer *User, repo *Repository) {
var content bytes.Buffer
if err := templates.ExecuteTemplate(&content, string(mailNotifyCollaborator), data); err != nil {
- log.Error(3, "Template: %v", err)
+ log.Error("Template: %v", err)
return
}
@@ -165,7 +165,7 @@ func composeIssueCommentMessage(issue *Issue, doer *User, content string, commen
var mailBody bytes.Buffer
if err := templates.ExecuteTemplate(&mailBody, string(tplName), data); err != nil {
- log.Error(3, "Template: %v", err)
+ log.Error("Template: %v", err)
}
msg := mailer.NewMessageFrom(tos, doer.DisplayName(), setting.MailService.FromEmail, subject, mailBody.String())
diff --git a/models/migrations/migrations.go b/models/migrations/migrations.go
index 2807de78b1..fda37f8da8 100644
--- a/models/migrations/migrations.go
+++ b/models/migrations/migrations.go
@@ -244,7 +244,7 @@ func Migrate(x *xorm.Engine) error {
v := currentVersion.Version
if minDBVersion > v {
- log.Fatal(4, `Gitea no longer supports auto-migration from your previously installed version.
+ log.Fatal(`Gitea no longer supports auto-migration from your previously installed version.
Please try to upgrade to a lower version (>= v0.6.0) first, then upgrade to current version.`)
return nil
}
@@ -315,7 +315,7 @@ func dropTableColumns(sess *xorm.Session, tableName string, columnNames ...strin
return sess.Commit()
default:
- log.Fatal(4, "Unrecognized DB")
+ log.Fatal("Unrecognized DB")
}
return nil
diff --git a/models/migrations/v33.go b/models/migrations/v33.go
index 26cce0b3c7..ae7612e68c 100644
--- a/models/migrations/v33.go
+++ b/models/migrations/v33.go
@@ -26,7 +26,7 @@ func removeActionColumns(x *xorm.Engine) error {
return fmt.Errorf("DROP COLUMN repo_name: %v", err)
}
default:
- log.Fatal(4, "Unrecognized DB")
+ log.Fatal("Unrecognized DB")
}
return nil
}
diff --git a/models/migrations/v45.go b/models/migrations/v45.go
index 9ad27cf6db..92cb817819 100644
--- a/models/migrations/v45.go
+++ b/models/migrations/v45.go
@@ -21,7 +21,7 @@ func removeIndexColumnFromRepoUnitTable(x *xorm.Engine) (err error) {
log.Warn("DROP COLUMN index: %v", err)
}
default:
- log.Fatal(4, "Unrecognized DB")
+ log.Fatal("Unrecognized DB")
}
return nil
diff --git a/models/migrations/v50.go b/models/migrations/v50.go
index 4ed8f05157..a15914f0ee 100644
--- a/models/migrations/v50.go
+++ b/models/migrations/v50.go
@@ -48,7 +48,7 @@ func migrateProtectedBranchStruct(x *xorm.Engine) error {
log.Warn("DROP COLUMN can_push (skipping): %v", err)
}
default:
- log.Fatal(4, "Unrecognized DB")
+ log.Fatal("Unrecognized DB")
}
return nil
diff --git a/models/migrations/v61.go b/models/migrations/v61.go
index bcbc7553b8..8d9b7e2d23 100644
--- a/models/migrations/v61.go
+++ b/models/migrations/v61.go
@@ -33,7 +33,7 @@ func addSizeToAttachment(x *xorm.Engine) error {
localPath := path.Join(setting.AttachmentPath, attach.UUID[0:1], attach.UUID[1:2], attach.UUID)
fi, err := os.Stat(localPath)
if err != nil {
- log.Error(4, "calculate file size of attachment[UUID: %s]: %v", attach.UUID, err)
+ log.Error("calculate file size of attachment[UUID: %s]: %v", attach.UUID, err)
continue
}
attach.Size = fi.Size()
diff --git a/models/org.go b/models/org.go
index 2e22ae987b..5235dad7a7 100644
--- a/models/org.go
+++ b/models/org.go
@@ -303,7 +303,7 @@ func isOrganizationOwner(e Engine, orgID, uid int64) (bool, error) {
if has, err := e.Get(ownerTeam); err != nil {
return false, err
} else if !has {
- log.Error(4, "Organization does not have owner team: %d", orgID)
+ log.Error("Organization does not have owner team: %d", orgID)
return false, nil
}
return isTeamMember(e, orgID, ownerTeam.ID, uid)
diff --git a/models/org_team.go b/models/org_team.go
index 40fdeaa75e..ccee9f544b 100644
--- a/models/org_team.go
+++ b/models/org_team.go
@@ -69,7 +69,7 @@ func (t *Team) IsOwnerTeam() bool {
func (t *Team) IsMember(userID int64) bool {
isMember, err := IsTeamMember(t.OrgID, t.ID, userID)
if err != nil {
- log.Error(4, "IsMember: %v", err)
+ log.Error("IsMember: %v", err)
return false
}
return isMember
diff --git a/models/pull.go b/models/pull.go
index ef3ec8e145..ccd8155317 100644
--- a/models/pull.go
+++ b/models/pull.go
@@ -135,7 +135,7 @@ func (pr *PullRequest) GetDefaultMergeMessage() string {
var err error
pr.HeadRepo, err = GetRepositoryByID(pr.HeadRepoID)
if err != nil {
- log.Error(4, "GetRepositoryById[%d]: %v", pr.HeadRepoID, err)
+ log.Error("GetRepositoryById[%d]: %v", pr.HeadRepoID, err)
return ""
}
}
@@ -145,7 +145,7 @@ func (pr *PullRequest) GetDefaultMergeMessage() string {
// GetDefaultSquashMessage returns default message used when squash and merging pull request
func (pr *PullRequest) GetDefaultSquashMessage() string {
if err := pr.LoadIssue(); err != nil {
- log.Error(4, "LoadIssue: %v", err)
+ log.Error("LoadIssue: %v", err)
return ""
}
return fmt.Sprintf("%s (#%d)", pr.Issue.Title, pr.Issue.Index)
@@ -172,21 +172,21 @@ func (pr *PullRequest) apiFormat(e Engine) *api.PullRequest {
err error
)
if err = pr.Issue.loadRepo(e); err != nil {
- log.Error(log.ERROR, "loadRepo[%d]: %v", pr.ID, err)
+ log.Error("loadRepo[%d]: %v", pr.ID, err)
return nil
}
apiIssue := pr.Issue.apiFormat(e)
if pr.BaseRepo == nil {
pr.BaseRepo, err = getRepositoryByID(e, pr.BaseRepoID)
if err != nil {
- log.Error(log.ERROR, "GetRepositoryById[%d]: %v", pr.ID, err)
+ log.Error("GetRepositoryById[%d]: %v", pr.ID, err)
return nil
}
}
if pr.HeadRepo == nil {
pr.HeadRepo, err = getRepositoryByID(e, pr.HeadRepoID)
if err != nil {
- log.Error(log.ERROR, "GetRepositoryById[%d]: %v", pr.ID, err)
+ log.Error("GetRepositoryById[%d]: %v", pr.ID, err)
return nil
}
}
@@ -581,11 +581,11 @@ func (pr *PullRequest) Merge(doer *User, baseGitRepo *git.Repository, mergeStyle
pr.MergerID = doer.ID
if err = pr.setMerged(); err != nil {
- log.Error(4, "setMerged [%d]: %v", pr.ID, err)
+ log.Error("setMerged [%d]: %v", pr.ID, err)
}
if err = MergePullRequestAction(doer, pr.Issue.Repo, pr.Issue); err != nil {
- log.Error(4, "MergePullRequestAction [%d]: %v", pr.ID, err)
+ log.Error("MergePullRequestAction [%d]: %v", pr.ID, err)
}
// Reset cached commit count
@@ -593,7 +593,7 @@ func (pr *PullRequest) Merge(doer *User, baseGitRepo *git.Repository, mergeStyle
// Reload pull request information.
if err = pr.LoadAttributes(); err != nil {
- log.Error(4, "LoadAttributes: %v", err)
+ log.Error("LoadAttributes: %v", err)
return nil
}
@@ -605,14 +605,14 @@ func (pr *PullRequest) Merge(doer *User, baseGitRepo *git.Repository, mergeStyle
Repository: pr.Issue.Repo.APIFormat(mode),
Sender: doer.APIFormat(),
}); err != nil {
- log.Error(4, "PrepareWebhooks: %v", err)
+ log.Error("PrepareWebhooks: %v", err)
} else {
go HookQueue.Add(pr.Issue.Repo.ID)
}
l, err := baseGitRepo.CommitsBetweenIDs(pr.MergedCommitID, pr.MergeBase)
if err != nil {
- log.Error(4, "CommitsBetweenIDs: %v", err)
+ log.Error("CommitsBetweenIDs: %v", err)
return nil
}
@@ -621,7 +621,7 @@ func (pr *PullRequest) Merge(doer *User, baseGitRepo *git.Repository, mergeStyle
// to avoid strange diff commits produced.
mergeCommit, err := baseGitRepo.GetBranchCommit(pr.BaseBranch)
if err != nil {
- log.Error(4, "GetBranchCommit: %v", err)
+ log.Error("GetBranchCommit: %v", err)
return nil
}
if mergeStyle == MergeStyleMerge {
@@ -639,7 +639,7 @@ func (pr *PullRequest) Merge(doer *User, baseGitRepo *git.Repository, mergeStyle
Sender: doer.APIFormat(),
}
if err = PrepareWebhooks(pr.BaseRepo, HookEventPush, p); err != nil {
- log.Error(4, "PrepareWebhooks: %v", err)
+ log.Error("PrepareWebhooks: %v", err)
} else {
go HookQueue.Add(pr.BaseRepo.ID)
}
@@ -692,7 +692,7 @@ func (pr *PullRequest) setMerged() (err error) {
func (pr *PullRequest) manuallyMerged() bool {
commit, err := pr.getMergeCommit()
if err != nil {
- log.Error(4, "PullRequest[%d].getMergeCommit: %v", pr.ID, err)
+ log.Error("PullRequest[%d].getMergeCommit: %v", pr.ID, err)
return false
}
if commit != nil {
@@ -705,7 +705,7 @@ func (pr *PullRequest) manuallyMerged() bool {
if merger == nil {
if pr.BaseRepo.Owner == nil {
if err = pr.BaseRepo.getOwner(x); err != nil {
- log.Error(4, "BaseRepo.getOwner[%d]: %v", pr.ID, err)
+ log.Error("BaseRepo.getOwner[%d]: %v", pr.ID, err)
return false
}
}
@@ -715,7 +715,7 @@ func (pr *PullRequest) manuallyMerged() bool {
pr.MergerID = merger.ID
if err = pr.setMerged(); err != nil {
- log.Error(4, "PullRequest[%d].setMerged : %v", pr.ID, err)
+ log.Error("PullRequest[%d].setMerged : %v", pr.ID, err)
return false
}
log.Info("manuallyMerged[%d]: Marked as manually merged into %s/%s by commit id: %s", pr.ID, pr.BaseRepo.Name, pr.BaseBranch, commit.ID.String())
@@ -936,7 +936,7 @@ func NewPullRequest(repo *Repository, pull *Issue, labelIDs []int64, uuids []str
Repo: repo,
IsPrivate: repo.IsPrivate,
}); err != nil {
- log.Error(4, "NotifyWatchers: %v", err)
+ log.Error("NotifyWatchers: %v", err)
}
pr.Issue = pull
@@ -949,7 +949,7 @@ func NewPullRequest(repo *Repository, pull *Issue, labelIDs []int64, uuids []str
Repository: repo.APIFormat(mode),
Sender: pull.Poster.APIFormat(),
}); err != nil {
- log.Error(4, "PrepareWebhooks: %v", err)
+ log.Error("PrepareWebhooks: %v", err)
} else {
go HookQueue.Add(repo.ID)
}
@@ -997,12 +997,12 @@ func PullRequests(baseRepoID int64, opts *PullRequestsOptions) ([]*PullRequest,
countSession, err := listPullRequestStatement(baseRepoID, opts)
if err != nil {
- log.Error(4, "listPullRequestStatement", err)
+ log.Error("listPullRequestStatement: %v", err)
return nil, 0, err
}
maxResults, err := countSession.Count(new(PullRequest))
if err != nil {
- log.Error(4, "Count PRs", err)
+ log.Error("Count PRs: %v", err)
return nil, maxResults, err
}
@@ -1010,7 +1010,7 @@ func PullRequests(baseRepoID int64, opts *PullRequestsOptions) ([]*PullRequest,
findSession, err := listPullRequestStatement(baseRepoID, opts)
sortIssuesSession(findSession, opts.SortType)
if err != nil {
- log.Error(4, "listPullRequestStatement", err)
+ log.Error("listPullRequestStatement: %v", err)
return nil, maxResults, err
}
findSession.Limit(ItemsPerPage, (opts.Page-1)*ItemsPerPage)
@@ -1215,7 +1215,7 @@ func (pr *PullRequest) AddToTaskQueue() {
go pullRequestQueue.AddFunc(pr.ID, func() {
pr.Status = PullRequestStatusChecking
if err := pr.UpdateCols("status"); err != nil {
- log.Error(5, "AddToTaskQueue.UpdateCols[%d].(add to queue): %v", pr.ID, err)
+ log.Error("AddToTaskQueue.UpdateCols[%d].(add to queue): %v", pr.ID, err)
}
})
}
@@ -1290,10 +1290,10 @@ func addHeadRepoTasks(prs []*PullRequest) {
for _, pr := range prs {
log.Trace("addHeadRepoTasks[%d]: composing new test task", pr.ID)
if err := pr.UpdatePatch(); err != nil {
- log.Error(4, "UpdatePatch: %v", err)
+ log.Error("UpdatePatch: %v", err)
continue
} else if err := pr.PushToBaseRepo(); err != nil {
- log.Error(4, "PushToBaseRepo: %v", err)
+ log.Error("PushToBaseRepo: %v", err)
continue
}
@@ -1307,23 +1307,23 @@ func AddTestPullRequestTask(doer *User, repoID int64, branch string, isSync bool
log.Trace("AddTestPullRequestTask [head_repo_id: %d, head_branch: %s]: finding pull requests", repoID, branch)
prs, err := GetUnmergedPullRequestsByHeadInfo(repoID, branch)
if err != nil {
- log.Error(4, "Find pull requests [head_repo_id: %d, head_branch: %s]: %v", repoID, branch, err)
+ log.Error("Find pull requests [head_repo_id: %d, head_branch: %s]: %v", repoID, branch, err)
return
}
if isSync {
requests := PullRequestList(prs)
if err = requests.LoadAttributes(); err != nil {
- log.Error(4, "PullRequestList.LoadAttributes: %v", err)
+ log.Error("PullRequestList.LoadAttributes: %v", err)
}
if invalidationErr := checkForInvalidation(requests, repoID, doer, branch); invalidationErr != nil {
- log.Error(4, "checkForInvalidation: %v", invalidationErr)
+ log.Error("checkForInvalidation: %v", invalidationErr)
}
if err == nil {
for _, pr := range prs {
pr.Issue.PullRequest = pr
if err = pr.Issue.LoadAttributes(); err != nil {
- log.Error(4, "LoadAttributes: %v", err)
+ log.Error("LoadAttributes: %v", err)
continue
}
if err = PrepareWebhooks(pr.Issue.Repo, HookEventPullRequest, &api.PullRequestPayload{
@@ -1333,7 +1333,7 @@ func AddTestPullRequestTask(doer *User, repoID int64, branch string, isSync bool
Repository: pr.Issue.Repo.APIFormat(AccessModeNone),
Sender: doer.APIFormat(),
}); err != nil {
- log.Error(4, "PrepareWebhooks [pull_id: %v]: %v", pr.ID, err)
+ log.Error("PrepareWebhooks [pull_id: %v]: %v", pr.ID, err)
continue
}
go HookQueue.Add(pr.Issue.Repo.ID)
@@ -1347,7 +1347,7 @@ func AddTestPullRequestTask(doer *User, repoID int64, branch string, isSync bool
log.Trace("AddTestPullRequestTask [base_repo_id: %d, base_branch: %s]: finding pull requests", repoID, branch)
prs, err = GetUnmergedPullRequestsByBaseInfo(repoID, branch)
if err != nil {
- log.Error(4, "Find pull requests [base_repo_id: %d, base_branch: %s]: %v", repoID, branch, err)
+ log.Error("Find pull requests [base_repo_id: %d, base_branch: %s]: %v", repoID, branch, err)
return
}
for _, pr := range prs {
@@ -1367,7 +1367,7 @@ func checkForInvalidation(requests PullRequestList, repoID int64, doer *User, br
go func() {
err := requests.InvalidateCodeComments(doer, gitRepo, branch)
if err != nil {
- log.Error(4, "PullRequestList.InvalidateCodeComments: %v", err)
+ log.Error("PullRequestList.InvalidateCodeComments: %v", err)
}
}()
return nil
@@ -1396,7 +1396,7 @@ func (pr *PullRequest) checkAndUpdateStatus() {
// Make sure there is no waiting test to process before leaving the checking status.
if !pullRequestQueue.Exist(pr.ID) {
if err := pr.UpdateCols("status, conflicted_files"); err != nil {
- log.Error(4, "Update[%d]: %v", pr.ID, err)
+ log.Error("Update[%d]: %v", pr.ID, err)
}
}
}
@@ -1404,7 +1404,7 @@ func (pr *PullRequest) checkAndUpdateStatus() {
// IsWorkInProgress determine if the Pull Request is a Work In Progress by its title
func (pr *PullRequest) IsWorkInProgress() bool {
if err := pr.LoadIssue(); err != nil {
- log.Error(4, "LoadIssue: %v", err)
+ log.Error("LoadIssue: %v", err)
return false
}
@@ -1425,7 +1425,7 @@ func (pr *PullRequest) IsFilesConflicted() bool {
// It returns an empty string when none were found
func (pr *PullRequest) GetWorkInProgressPrefix() string {
if err := pr.LoadIssue(); err != nil {
- log.Error(4, "LoadIssue: %v", err)
+ log.Error("LoadIssue: %v", err)
return ""
}
@@ -1444,7 +1444,7 @@ func TestPullRequests() {
err := x.Where("status = ?", PullRequestStatusChecking).Find(&prs)
if err != nil {
- log.Error(3, "Find Checking PRs", err)
+ log.Error("Find Checking PRs: %v", err)
return
}
@@ -1454,14 +1454,14 @@ func TestPullRequests() {
for _, pr := range prs {
checkedPRs[pr.ID] = struct{}{}
if err := pr.GetBaseRepo(); err != nil {
- log.Error(3, "GetBaseRepo: %v", err)
+ log.Error("GetBaseRepo: %v", err)
continue
}
if pr.manuallyMerged() {
continue
}
if err := pr.testPatch(x); err != nil {
- log.Error(3, "testPatch: %v", err)
+ log.Error("testPatch: %v", err)
continue
}
@@ -1480,12 +1480,12 @@ func TestPullRequests() {
pr, err := GetPullRequestByID(id)
if err != nil {
- log.Error(4, "GetPullRequestByID[%s]: %v", prID, err)
+ log.Error("GetPullRequestByID[%s]: %v", prID, err)
continue
} else if pr.manuallyMerged() {
continue
} else if err = pr.testPatch(x); err != nil {
- log.Error(4, "testPatch[%d]: %v", pr.ID, err)
+ log.Error("testPatch[%d]: %v", pr.ID, err)
continue
}
diff --git a/models/release.go b/models/release.go
index f147016b13..b2d5348248 100644
--- a/models/release.go
+++ b/models/release.go
@@ -199,7 +199,7 @@ func CreateRelease(gitRepo *git.Repository, rel *Release, attachmentUUIDs []stri
if !rel.IsDraft {
if err := rel.LoadAttributes(); err != nil {
- log.Error(2, "LoadAttributes: %v", err)
+ log.Error("LoadAttributes: %v", err)
} else {
mode, _ := AccessLevel(rel.Publisher, rel.Repo)
if err := PrepareWebhooks(rel.Repo, HookEventRelease, &api.ReleasePayload{
@@ -208,7 +208,7 @@ func CreateRelease(gitRepo *git.Repository, rel *Release, attachmentUUIDs []stri
Repository: rel.Repo.APIFormat(mode),
Sender: rel.Publisher.APIFormat(),
}); err != nil {
- log.Error(2, "PrepareWebhooks: %v", err)
+ log.Error("PrepareWebhooks: %v", err)
} else {
go HookQueue.Add(rel.Repo.ID)
}
@@ -409,7 +409,7 @@ func UpdateRelease(doer *User, gitRepo *git.Repository, rel *Release, attachment
Repository: rel.Repo.APIFormat(mode),
Sender: rel.Publisher.APIFormat(),
}); err1 != nil {
- log.Error(2, "PrepareWebhooks: %v", err)
+ log.Error("PrepareWebhooks: %v", err)
} else {
go HookQueue.Add(rel.Repo.ID)
}
@@ -464,7 +464,7 @@ func DeleteReleaseByID(id int64, u *User, delTag bool) error {
Repository: rel.Repo.APIFormat(mode),
Sender: rel.Publisher.APIFormat(),
}); err != nil {
- log.Error(2, "PrepareWebhooks: %v", err)
+ log.Error("PrepareWebhooks: %v", err)
} else {
go HookQueue.Add(rel.Repo.ID)
}
diff --git a/models/repo.go b/models/repo.go
index 19526fb17c..5cdee6c3f9 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -74,13 +74,13 @@ func LoadRepoConfig() {
for i, t := range types {
files, err := options.Dir(t)
if err != nil {
- log.Fatal(4, "Failed to get %s files: %v", t, err)
+ log.Fatal("Failed to get %s files: %v", t, err)
}
customPath := path.Join(setting.CustomPath, "options", t)
if com.IsDir(customPath) {
customFiles, err := com.StatDir(customPath)
if err != nil {
- log.Fatal(4, "Failed to get custom %s files: %v", t, err)
+ log.Fatal("Failed to get custom %s files: %v", t, err)
}
for _, f := range customFiles {
@@ -122,19 +122,19 @@ func NewRepoContext() {
// Check Git installation.
if _, err := exec.LookPath("git"); err != nil {
- log.Fatal(4, "Failed to test 'git' command: %v (forgotten install?)", err)
+ log.Fatal("Failed to test 'git' command: %v (forgotten install?)", err)
}
// Check Git version.
var err error
setting.Git.Version, err = git.BinVersion()
if err != nil {
- log.Fatal(4, "Failed to get Git version: %v", err)
+ log.Fatal("Failed to get Git version: %v", err)
}
log.Info("Git Version: %s", setting.Git.Version)
if version.Compare("1.7.1", setting.Git.Version, ">") {
- log.Fatal(4, "Gitea requires Git version greater or equal to 1.7.1")
+ log.Fatal("Gitea requires Git version greater or equal to 1.7.1")
}
// Git requires setting user.name and user.email in order to commit changes.
@@ -143,11 +143,11 @@ func NewRepoContext() {
// ExitError indicates this config is not set
if _, ok := err.(*exec.ExitError); ok || strings.TrimSpace(stdout) == "" {
if _, stderr, gerr := process.GetManager().Exec("NewRepoContext(set "+configKey+")", "git", "config", "--global", configKey, defaultValue); gerr != nil {
- log.Fatal(4, "Failed to set git %s(%s): %s", configKey, gerr, stderr)
+ log.Fatal("Failed to set git %s(%s): %s", configKey, gerr, stderr)
}
log.Info("Git config %s set to %s", configKey, defaultValue)
} else {
- log.Fatal(4, "Failed to get git %s(%s): %s", configKey, err, stderr)
+ log.Fatal("Failed to get git %s(%s): %s", configKey, err, stderr)
}
}
}
@@ -155,7 +155,7 @@ func NewRepoContext() {
// Set git some configurations.
if _, stderr, err := process.GetManager().Exec("NewRepoContext(git config --global core.quotepath false)",
"git", "config", "--global", "core.quotepath", "false"); err != nil {
- log.Fatal(4, "Failed to execute 'git config --global core.quotepath false': %s", stderr)
+ log.Fatal("Failed to execute 'git config --global core.quotepath false': %s", stderr)
}
RemoveAllWithNotice("Clean up repository temporary data", filepath.Join(setting.AppDataPath, "tmp"))
@@ -281,7 +281,7 @@ func (repo *Repository) innerAPIFormat(e Engine, mode AccessMode, isParent bool)
if !isParent {
err := repo.getBaseRepo(e)
if err != nil {
- log.Error(4, "APIFormat: %v", err)
+ log.Error("APIFormat: %v", err)
}
if repo.BaseRepo != nil {
parent = repo.BaseRepo.innerAPIFormat(e, mode, true)
@@ -462,7 +462,7 @@ func (repo *Repository) GetOwnerName() error {
func (repo *Repository) mustOwnerName(e Engine) string {
if err := repo.getOwnerName(e); err != nil {
- log.Error(4, "Error loading repository owner name: %v", err)
+ log.Error("Error loading repository owner name: %v", err)
return "error"
}
@@ -724,7 +724,7 @@ var (
func (repo *Repository) DescriptionHTML() template.HTML {
desc, err := markup.RenderDescriptionHTML([]byte(repo.Description), repo.HTMLURL(), repo.ComposeMetas())
if err != nil {
- log.Error(4, "Failed to render description for %s (ID: %d): %v", repo.Name, repo.ID, err)
+ log.Error("Failed to render description for %s (ID: %d): %v", repo.Name, repo.ID, err)
return template.HTML(markup.Sanitize(repo.Description))
}
return template.HTML(markup.Sanitize(string(desc)))
@@ -981,12 +981,12 @@ func MigrateRepository(doer, u *User, opts MigrateRepoOptions) (*Repository, err
}
if err = SyncReleasesWithTags(repo, gitRepo); err != nil {
- log.Error(4, "Failed to synchronize tags to releases for repository: %v", err)
+ log.Error("Failed to synchronize tags to releases for repository: %v", err)
}
}
if err = repo.UpdateSize(); err != nil {
- log.Error(4, "Failed to update size for repository: %v", err)
+ log.Error("Failed to update size for repository: %v", err)
}
if opts.IsMirror {
@@ -1405,7 +1405,7 @@ func CreateRepository(doer, u *User, opts CreateRepoOptions) (_ *Repository, err
repoPath := RepoPath(u.Name, repo.Name)
if err = initRepository(sess, repoPath, u, repo, opts); err != nil {
if err2 := os.RemoveAll(repoPath); err2 != nil {
- log.Error(4, "initRepository: %v", err)
+ log.Error("initRepository: %v", err)
return nil, fmt.Errorf(
"delete repo directory %s/%s failed(2): %v", u.Name, repo.Name, err2)
}
@@ -1435,7 +1435,7 @@ func countRepositories(userID int64, private bool) int64 {
count, err := sess.Count(new(Repository))
if err != nil {
- log.Error(4, "countRepositories: %v", err)
+ log.Error("countRepositories: %v", err)
}
return count
}
@@ -1690,11 +1690,11 @@ func updateRepository(e Engine, repo *Repository, visibilityChanged bool) (err e
daemonExportFile := path.Join(repo.repoPath(e), `git-daemon-export-ok`)
if repo.IsPrivate && com.IsExist(daemonExportFile) {
if err = os.Remove(daemonExportFile); err != nil {
- log.Error(4, "Failed to remove %s: %v", daemonExportFile, err)
+ log.Error("Failed to remove %s: %v", daemonExportFile, err)
}
} else if !repo.IsPrivate && !com.IsExist(daemonExportFile) {
if f, err := os.Create(daemonExportFile); err != nil {
- log.Error(4, "Failed to create %s: %v", daemonExportFile, err)
+ log.Error("Failed to create %s: %v", daemonExportFile, err)
} else {
f.Close()
}
@@ -1712,7 +1712,7 @@ func updateRepository(e Engine, repo *Repository, visibilityChanged bool) (err e
}
if err = repo.updateSize(e); err != nil {
- log.Error(4, "Failed to update size for repository: %v", err)
+ log.Error("Failed to update size for repository: %v", err)
}
}
@@ -1928,7 +1928,7 @@ func DeleteRepository(doer *User, uid, repoID int64) error {
if repo.NumForks > 0 {
if _, err = sess.Exec("UPDATE `repository` SET fork_id=0,is_fork=? WHERE fork_id=?", false, repo.ID); err != nil {
- log.Error(4, "reset 'fork_id' and 'is_fork': %v", err)
+ log.Error("reset 'fork_id' and 'is_fork': %v", err)
}
}
@@ -2090,7 +2090,7 @@ func DeleteOldRepositoryArchives() {
log.Trace("Doing: ArchiveCleanup")
if err := x.Where("id > 0").Iterate(new(Repository), deleteOldRepositoryArchives); err != nil {
- log.Error(4, "ArchiveClean: %v", err)
+ log.Error("ArchiveClean: %v", err)
}
}
@@ -2243,12 +2243,12 @@ func GitFsck() {
desc := fmt.Sprintf("Failed to health check repository (%s): %v", repoPath, err)
log.Warn(desc)
if err = CreateRepositoryNotice(desc); err != nil {
- log.Error(4, "CreateRepositoryNotice: %v", err)
+ log.Error("CreateRepositoryNotice: %v", err)
}
}
return nil
}); err != nil {
- log.Error(4, "GitFsck: %v", err)
+ log.Error("GitFsck: %v", err)
}
log.Trace("Finished: GitFsck")
}
@@ -2283,7 +2283,7 @@ type repoChecker struct {
func repoStatsCheck(checker *repoChecker) {
results, err := x.Query(checker.querySQL)
if err != nil {
- log.Error(4, "Select %s: %v", checker.desc, err)
+ log.Error("Select %s: %v", checker.desc, err)
return
}
for _, result := range results {
@@ -2291,7 +2291,7 @@ func repoStatsCheck(checker *repoChecker) {
log.Trace("Updating %s: %d", checker.desc, id)
_, err = x.Exec(checker.correctSQL, id, id)
if err != nil {
- log.Error(4, "Update %s[%d]: %v", checker.desc, id, err)
+ log.Error("Update %s[%d]: %v", checker.desc, id, err)
}
}
}
@@ -2345,14 +2345,14 @@ func CheckRepoStats() {
desc := "repository count 'num_closed_issues'"
results, err := x.Query("SELECT repo.id FROM `repository` repo WHERE repo.num_closed_issues!=(SELECT COUNT(*) FROM `issue` WHERE repo_id=repo.id AND is_closed=? AND is_pull=?)", true, false)
if err != nil {
- log.Error(4, "Select %s: %v", desc, err)
+ log.Error("Select %s: %v", desc, err)
} else {
for _, result := range results {
id := com.StrTo(result["id"]).MustInt64()
log.Trace("Updating %s: %d", desc, id)
_, err = x.Exec("UPDATE `repository` SET num_closed_issues=(SELECT COUNT(*) FROM `issue` WHERE repo_id=? AND is_closed=? AND is_pull=?) WHERE id=?", id, true, false, id)
if err != nil {
- log.Error(4, "Update %s[%d]: %v", desc, id, err)
+ log.Error("Update %s[%d]: %v", desc, id, err)
}
}
}
@@ -2362,7 +2362,7 @@ func CheckRepoStats() {
// ***** START: Repository.NumForks *****
results, err = x.Query("SELECT repo.id FROM `repository` repo WHERE repo.num_forks!=(SELECT COUNT(*) FROM `repository` WHERE fork_id=repo.id)")
if err != nil {
- log.Error(4, "Select repository count 'num_forks': %v", err)
+ log.Error("Select repository count 'num_forks': %v", err)
} else {
for _, result := range results {
id := com.StrTo(result["id"]).MustInt64()
@@ -2370,19 +2370,19 @@ func CheckRepoStats() {
repo, err := GetRepositoryByID(id)
if err != nil {
- log.Error(4, "GetRepositoryByID[%d]: %v", id, err)
+ log.Error("GetRepositoryByID[%d]: %v", id, err)
continue
}
rawResult, err := x.Query("SELECT COUNT(*) FROM `repository` WHERE fork_id=?", repo.ID)
if err != nil {
- log.Error(4, "Select count of forks[%d]: %v", repo.ID, err)
+ log.Error("Select count of forks[%d]: %v", repo.ID, err)
continue
}
repo.NumForks = int(parseCountResult(rawResult))
if err = UpdateRepository(repo, false); err != nil {
- log.Error(4, "UpdateRepository[%d]: %v", id, err)
+ log.Error("UpdateRepository[%d]: %v", id, err)
continue
}
}
@@ -2485,13 +2485,13 @@ func ForkRepository(doer, u *User, oldRepo *Repository, name, desc string) (_ *R
Repo: repo.APIFormat(mode),
Sender: doer.APIFormat(),
}); err != nil {
- log.Error(2, "PrepareWebhooks [repo_id: %d]: %v", oldRepo.ID, err)
+ log.Error("PrepareWebhooks [repo_id: %d]: %v", oldRepo.ID, err)
} else {
go HookQueue.Add(oldRepo.ID)
}
if err = repo.UpdateSize(); err != nil {
- log.Error(4, "Failed to update size for repository: %v", err)
+ log.Error("Failed to update size for repository: %v", err)
}
// Copy LFS meta objects in new session
diff --git a/models/repo_indexer.go b/models/repo_indexer.go
index bfeeca26e9..9a7daa0ff8 100644
--- a/models/repo_indexer.go
+++ b/models/repo_indexer.go
@@ -113,7 +113,7 @@ func populateRepoIndexer(maxRepoID int64) {
Limit(RepositoryListDefaultPageSize).
Find(&repos)
if err != nil {
- log.Error(4, "populateRepoIndexer: %v", err)
+ log.Error("populateRepoIndexer: %v", err)
return
} else if len(repos) == 0 {
break
@@ -314,11 +314,11 @@ func processRepoIndexerOperationQueue() {
op := <-repoIndexerOperationQueue
if op.deleted {
if err := indexer.DeleteRepoFromIndexer(op.repo.ID); err != nil {
- log.Error(4, "DeleteRepoFromIndexer: %v", err)
+ log.Error("DeleteRepoFromIndexer: %v", err)
}
} else {
if err := updateRepoIndexer(op.repo); err != nil {
- log.Error(4, "updateRepoIndexer: %v", err)
+ log.Error("updateRepoIndexer: %v", err)
}
}
}
diff --git a/models/repo_mirror.go b/models/repo_mirror.go
index c3fc9a43db..759241e461 100644
--- a/models/repo_mirror.go
+++ b/models/repo_mirror.go
@@ -57,7 +57,7 @@ func (m *Mirror) AfterLoad(session *xorm.Session) {
var err error
m.Repo, err = getRepositoryByID(session, m.RepoID)
if err != nil {
- log.Error(3, "getRepositoryByID[%d]: %v", m.ID, err)
+ log.Error("getRepositoryByID[%d]: %v", m.ID, err)
}
}
@@ -85,7 +85,7 @@ func (m *Mirror) readAddress() {
var err error
m.address, err = remoteAddress(m.Repo.RepoPath())
if err != nil {
- log.Error(4, "remoteAddress: %v", err)
+ log.Error("remoteAddress: %v", err)
}
}
@@ -164,12 +164,12 @@ func parseRemoteUpdateOutput(output string) []*mirrorSyncResult {
case strings.HasPrefix(lines[i], " "): // New commits of a reference
delimIdx := strings.Index(lines[i][3:], " ")
if delimIdx == -1 {
- log.Error(2, "SHA delimiter not found: %q", lines[i])
+ log.Error("SHA delimiter not found: %q", lines[i])
continue
}
shas := strings.Split(lines[i][3:delimIdx+3], "..")
if len(shas) != 2 {
- log.Error(2, "Expect two SHAs but not what found: %q", lines[i])
+ log.Error("Expect two SHAs but not what found: %q", lines[i])
continue
}
results = append(results, &mirrorSyncResult{
@@ -204,13 +204,13 @@ func (m *Mirror) runSync() ([]*mirrorSyncResult, bool) {
// contain a password
message, err := sanitizeOutput(stderr, repoPath)
if err != nil {
- log.Error(4, "sanitizeOutput: %v", err)
+ log.Error("sanitizeOutput: %v", err)
return nil, false
}
desc := fmt.Sprintf("Failed to update mirror repository '%s': %s", repoPath, message)
- log.Error(4, desc)
+ log.Error(desc)
if err = CreateRepositoryNotice(desc); err != nil {
- log.Error(4, "CreateRepositoryNotice: %v", err)
+ log.Error("CreateRepositoryNotice: %v", err)
}
return nil, false
}
@@ -218,15 +218,15 @@ func (m *Mirror) runSync() ([]*mirrorSyncResult, bool) {
gitRepo, err := git.OpenRepository(repoPath)
if err != nil {
- log.Error(4, "OpenRepository: %v", err)
+ log.Error("OpenRepository: %v", err)
return nil, false
}
if err = SyncReleasesWithTags(m.Repo, gitRepo); err != nil {
- log.Error(4, "Failed to synchronize tags to releases for repository: %v", err)
+ log.Error("Failed to synchronize tags to releases for repository: %v", err)
}
if err := m.Repo.UpdateSize(); err != nil {
- log.Error(4, "Failed to update size for mirror repository: %v", err)
+ log.Error("Failed to update size for mirror repository: %v", err)
}
if m.Repo.HasWiki() {
@@ -237,13 +237,13 @@ func (m *Mirror) runSync() ([]*mirrorSyncResult, bool) {
// contain a password
message, err := sanitizeOutput(stderr, wikiPath)
if err != nil {
- log.Error(4, "sanitizeOutput: %v", err)
+ log.Error("sanitizeOutput: %v", err)
return nil, false
}
desc := fmt.Sprintf("Failed to update mirror wiki repository '%s': %s", wikiPath, message)
- log.Error(4, desc)
+ log.Error(desc)
if err = CreateRepositoryNotice(desc); err != nil {
- log.Error(4, "CreateRepositoryNotice: %v", err)
+ log.Error("CreateRepositoryNotice: %v", err)
}
return nil, false
}
@@ -251,7 +251,7 @@ func (m *Mirror) runSync() ([]*mirrorSyncResult, bool) {
branches, err := m.Repo.GetBranches()
if err != nil {
- log.Error(4, "GetBranches: %v", err)
+ log.Error("GetBranches: %v", err)
return nil, false
}
@@ -310,14 +310,14 @@ func MirrorUpdate() {
Iterate(new(Mirror), func(idx int, bean interface{}) error {
m := bean.(*Mirror)
if m.Repo == nil {
- log.Error(4, "Disconnected mirror repository found: %d", m.ID)
+ log.Error("Disconnected mirror repository found: %d", m.ID)
return nil
}
MirrorQueue.Add(m.RepoID)
return nil
}); err != nil {
- log.Error(4, "MirrorUpdate: %v", err)
+ log.Error("MirrorUpdate: %v", err)
}
}
@@ -333,7 +333,7 @@ func SyncMirrors() {
m, err := GetMirrorByRepoID(com.StrTo(repoID).MustInt64())
if err != nil {
- log.Error(4, "GetMirrorByRepoID [%s]: %v", repoID, err)
+ log.Error("GetMirrorByRepoID [%s]: %v", repoID, err)
continue
}
@@ -344,7 +344,7 @@ func SyncMirrors() {
m.ScheduleNextUpdate()
if err = updateMirror(sess, m); err != nil {
- log.Error(4, "UpdateMirror [%s]: %v", repoID, err)
+ log.Error("UpdateMirror [%s]: %v", repoID, err)
continue
}
@@ -354,7 +354,7 @@ func SyncMirrors() {
} else {
gitRepo, err = git.OpenRepository(m.Repo.RepoPath())
if err != nil {
- log.Error(2, "OpenRepository [%d]: %v", m.RepoID, err)
+ log.Error("OpenRepository [%d]: %v", m.RepoID, err)
continue
}
}
@@ -368,7 +368,7 @@ func SyncMirrors() {
// Create reference
if result.oldCommitID == gitShortEmptySha {
if err = MirrorSyncCreateAction(m.Repo, result.refName); err != nil {
- log.Error(2, "MirrorSyncCreateAction [repo_id: %d]: %v", m.RepoID, err)
+ log.Error("MirrorSyncCreateAction [repo_id: %d]: %v", m.RepoID, err)
}
continue
}
@@ -376,7 +376,7 @@ func SyncMirrors() {
// Delete reference
if result.newCommitID == gitShortEmptySha {
if err = MirrorSyncDeleteAction(m.Repo, result.refName); err != nil {
- log.Error(2, "MirrorSyncDeleteAction [repo_id: %d]: %v", m.RepoID, err)
+ log.Error("MirrorSyncDeleteAction [repo_id: %d]: %v", m.RepoID, err)
}
continue
}
@@ -384,17 +384,17 @@ func SyncMirrors() {
// Push commits
oldCommitID, err := git.GetFullCommitID(gitRepo.Path, result.oldCommitID)
if err != nil {
- log.Error(2, "GetFullCommitID [%d]: %v", m.RepoID, err)
+ log.Error("GetFullCommitID [%d]: %v", m.RepoID, err)
continue
}
newCommitID, err := git.GetFullCommitID(gitRepo.Path, result.newCommitID)
if err != nil {
- log.Error(2, "GetFullCommitID [%d]: %v", m.RepoID, err)
+ log.Error("GetFullCommitID [%d]: %v", m.RepoID, err)
continue
}
commits, err := gitRepo.CommitsBetweenIDs(newCommitID, oldCommitID)
if err != nil {
- log.Error(2, "CommitsBetweenIDs [repo_id: %d, new_commit_id: %s, old_commit_id: %s]: %v", m.RepoID, newCommitID, oldCommitID, err)
+ log.Error("CommitsBetweenIDs [repo_id: %d, new_commit_id: %s, old_commit_id: %s]: %v", m.RepoID, newCommitID, oldCommitID, err)
continue
}
if err = MirrorSyncPushAction(m.Repo, MirrorSyncPushActionOptions{
@@ -403,7 +403,7 @@ func SyncMirrors() {
NewCommitID: newCommitID,
Commits: ListToPushCommits(commits),
}); err != nil {
- log.Error(2, "MirrorSyncPushAction [repo_id: %d]: %v", m.RepoID, err)
+ log.Error("MirrorSyncPushAction [repo_id: %d]: %v", m.RepoID, err)
continue
}
}
@@ -411,12 +411,12 @@ func SyncMirrors() {
// Get latest commit date and update to current repository updated time
commitDate, err := git.GetLatestCommitTime(m.Repo.RepoPath())
if err != nil {
- log.Error(2, "GetLatestCommitDate [%s]: %v", m.RepoID, err)
+ log.Error("GetLatestCommitDate [%d]: %v", m.RepoID, err)
continue
}
if _, err = sess.Exec("UPDATE repository SET updated_unix = ? WHERE id = ?", commitDate.Unix(), m.RepoID); err != nil {
- log.Error(2, "Update repository 'updated_unix' [%s]: %v", m.RepoID, err)
+ log.Error("Update repository 'updated_unix' [%d]: %v", m.RepoID, err)
continue
}
}
diff --git a/models/ssh_key.go b/models/ssh_key.go
index a7dced841d..fb5f9f399b 100644
--- a/models/ssh_key.go
+++ b/models/ssh_key.go
@@ -330,7 +330,7 @@ func appendAuthorizedKeysToFile(keys ...*PublicKey) error {
// .ssh directory should have mode 700, and authorized_keys file should have mode 600.
if fi.Mode().Perm() > 0600 {
- log.Error(4, "authorized_keys file has unusual permission flags: %s - setting to -rw-------", fi.Mode().Perm().String())
+ log.Error("authorized_keys file has unusual permission flags: %s - setting to -rw-------", fi.Mode().Perm().String())
if err = f.Chmod(0600); err != nil {
return err
}
diff --git a/models/status.go b/models/status.go
index 93d82b76fc..9cfd9e896f 100644
--- a/models/status.go
+++ b/models/status.go
@@ -281,7 +281,7 @@ func ParseCommitsWithStatus(oldCommits *list.List, repo *Repository) *list.List
}
statuses, err := GetLatestCommitStatus(repo, commit.ID.String(), 0)
if err != nil {
- log.Error(3, "GetLatestCommitStatus: %v", err)
+ log.Error("GetLatestCommitStatus: %v", err)
} else {
commit.Status = CalcCommitStatus(statuses)
}
diff --git a/models/u2f.go b/models/u2f.go
index 888c67d0c5..200d417fcc 100644
--- a/models/u2f.go
+++ b/models/u2f.go
@@ -52,7 +52,7 @@ func (list U2FRegistrationList) ToRegistrations() []u2f.Registration {
for _, reg := range list {
r, err := reg.Parse()
if err != nil {
- log.Fatal(4, "parsing u2f registration: %v", err)
+ log.Fatal("parsing u2f registration: %v", err)
continue
}
regs = append(regs, *r)
diff --git a/models/update.go b/models/update.go
index cde6b217c1..1492d6c0d3 100644
--- a/models/update.go
+++ b/models/update.go
@@ -215,7 +215,7 @@ func pushUpdate(opts PushUpdateOptions) (repo *Repository, err error) {
}
if err = repo.UpdateSize(); err != nil {
- log.Error(4, "Failed to update size for repository: %v", err)
+ log.Error("Failed to update size for repository: %v", err)
}
var commits = &PushCommits{}
diff --git a/models/user.go b/models/user.go
index b831a2ebfe..723892b0b6 100644
--- a/models/user.go
+++ b/models/user.go
@@ -367,7 +367,7 @@ func (u *User) SizedRelAvatarLink(size int) string {
case setting.DisableGravatar, setting.OfflineMode:
if !com.IsFile(u.CustomAvatarPath()) {
if err := u.GenerateRandomAvatar(); err != nil {
- log.Error(3, "GenerateRandomAvatar: %v", err)
+ log.Error("GenerateRandomAvatar: %v", err)
}
}
@@ -523,7 +523,7 @@ func (u *User) IsOrganization() bool {
func (u *User) IsUserOrgOwner(orgID int64) bool {
isOwner, err := IsOrganizationOwner(orgID, u.ID)
if err != nil {
- log.Error(4, "IsOrganizationOwner: %v", err)
+ log.Error("IsOrganizationOwner: %v", err)
return false
}
return isOwner
@@ -533,7 +533,7 @@ func (u *User) IsUserOrgOwner(orgID int64) bool {
func (u *User) IsUserPartOfOrg(userID int64) bool {
isMember, err := IsOrganizationMember(u.ID, userID)
if err != nil {
- log.Error(4, "IsOrganizationMember: %v", err)
+ log.Error("IsOrganizationMember: %v", err)
return false
}
return isMember
@@ -543,7 +543,7 @@ func (u *User) IsUserPartOfOrg(userID int64) bool {
func (u *User) IsPublicMember(orgID int64) bool {
isMember, err := IsPublicMembership(orgID, u.ID)
if err != nil {
- log.Error(4, "IsPublicMembership: %v", err)
+ log.Error("IsPublicMembership: %v", err)
return false
}
return isMember
@@ -864,7 +864,7 @@ func getVerifyUser(code string) (user *User) {
if user, err = GetUserByName(string(b)); user != nil {
return user
}
- log.Error(4, "user.getVerifyUser: %v", err)
+ log.Error("user.getVerifyUser: %v", err)
}
return nil
@@ -1490,11 +1490,11 @@ func deleteKeysMarkedForDeletion(keys []string) (bool, error) {
for _, KeyToDelete := range keys {
key, err := searchPublicKeyByContentWithEngine(sess, KeyToDelete)
if err != nil {
- log.Error(4, "SearchPublicKeyByContent: %v", err)
+ log.Error("SearchPublicKeyByContent: %v", err)
continue
}
if err = deletePublicKeys(sess, key.ID); err != nil {
- log.Error(4, "deletePublicKeys: %v", err)
+ log.Error("deletePublicKeys: %v", err)
continue
}
sshKeysNeedUpdate = true
@@ -1515,7 +1515,7 @@ func addLdapSSHPublicKeys(usr *User, s *LoginSource, SSHPublicKeys []string) boo
if err == nil {
sshKeyName := fmt.Sprintf("%s-%s", s.Name, sshKey[0:40])
if _, err := AddPublicKey(usr.ID, sshKeyName, sshKey, s.ID); err != nil {
- log.Error(4, "addLdapSSHPublicKeys[%s]: Error adding LDAP Public SSH Key for user %s: %v", s.Name, usr.Name, err)
+ log.Error("addLdapSSHPublicKeys[%s]: Error adding LDAP Public SSH Key for user %s: %v", s.Name, usr.Name, err)
} else {
log.Trace("addLdapSSHPublicKeys[%s]: Added LDAP Public SSH Key for user %s", s.Name, usr.Name)
sshKeysNeedUpdate = true
@@ -1537,7 +1537,7 @@ func synchronizeLdapSSHPublicKeys(usr *User, s *LoginSource, SSHPublicKeys []str
var giteaKeys []string
keys, err := ListPublicLdapSSHKeys(usr.ID, s.ID)
if err != nil {
- log.Error(4, "synchronizeLdapSSHPublicKeys[%s]: Error listing LDAP Public SSH Keys for user %s: %v", s.Name, usr.Name, err)
+ log.Error("synchronizeLdapSSHPublicKeys[%s]: Error listing LDAP Public SSH Keys for user %s: %v", s.Name, usr.Name, err)
}
for _, v := range keys {
@@ -1586,7 +1586,7 @@ func synchronizeLdapSSHPublicKeys(usr *User, s *LoginSource, SSHPublicKeys []str
// Delete LDAP keys from DB that doesn't exist in LDAP
needUpd, err := deleteKeysMarkedForDeletion(giteaKeysToDelete)
if err != nil {
- log.Error(4, "synchronizeLdapSSHPublicKeys[%s]: Error deleting LDAP Public SSH Keys marked for deletion for user %s: %v", s.Name, usr.Name, err)
+ log.Error("synchronizeLdapSSHPublicKeys[%s]: Error deleting LDAP Public SSH Keys marked for deletion for user %s: %v", s.Name, usr.Name, err)
}
if needUpd {
sshKeysNeedUpdate = true
@@ -1606,7 +1606,7 @@ func SyncExternalUsers() {
ls, err := LoginSources()
if err != nil {
- log.Error(4, "SyncExternalUsers: %v", err)
+ log.Error("SyncExternalUsers: %v", err)
return
}
@@ -1669,7 +1669,7 @@ func SyncExternalUsers() {
err = CreateUser(usr)
if err != nil {
- log.Error(4, "SyncExternalUsers[%s]: Error creating user %s: %v", s.Name, su.Username, err)
+ log.Error("SyncExternalUsers[%s]: Error creating user %s: %v", s.Name, su.Username, err)
} else if isAttributeSSHPublicKeySet {
log.Trace("SyncExternalUsers[%s]: Adding LDAP Public SSH Keys for user %s", s.Name, usr.Name)
if addLdapSSHPublicKeys(usr, s, su.SSHPublicKey) {
@@ -1702,7 +1702,7 @@ func SyncExternalUsers() {
err = UpdateUserCols(usr, "full_name", "email", "is_admin", "is_active")
if err != nil {
- log.Error(4, "SyncExternalUsers[%s]: Error updating user %s: %v", s.Name, usr.Name, err)
+ log.Error("SyncExternalUsers[%s]: Error updating user %s: %v", s.Name, usr.Name, err)
}
}
}
@@ -1729,7 +1729,7 @@ func SyncExternalUsers() {
usr.IsActive = false
err = UpdateUserCols(&usr, "is_active")
if err != nil {
- log.Error(4, "SyncExternalUsers[%s]: Error deactivating user %s: %v", s.Name, usr.Name, err)
+ log.Error("SyncExternalUsers[%s]: Error deactivating user %s: %v", s.Name, usr.Name, err)
}
}
}
diff --git a/models/webhook.go b/models/webhook.go
index cb5b5c7c97..eb22e95975 100644
--- a/models/webhook.go
+++ b/models/webhook.go
@@ -123,7 +123,7 @@ type Webhook struct {
func (w *Webhook) AfterLoad() {
w.HookEvent = &HookEvent{}
if err := json.Unmarshal([]byte(w.Events), w.HookEvent); err != nil {
- log.Error(3, "Unmarshal[%d]: %v", w.ID, err)
+ log.Error("Unmarshal[%d]: %v", w.ID, err)
}
}
@@ -131,7 +131,7 @@ func (w *Webhook) AfterLoad() {
func (w *Webhook) GetSlackHook() *SlackMeta {
s := &SlackMeta{}
if err := json.Unmarshal([]byte(w.Meta), s); err != nil {
- log.Error(4, "webhook.GetSlackHook(%d): %v", w.ID, err)
+ log.Error("webhook.GetSlackHook(%d): %v", w.ID, err)
}
return s
}
@@ -140,7 +140,7 @@ func (w *Webhook) GetSlackHook() *SlackMeta {
func (w *Webhook) GetDiscordHook() *DiscordMeta {
s := &DiscordMeta{}
if err := json.Unmarshal([]byte(w.Meta), s); err != nil {
- log.Error(4, "webhook.GetDiscordHook(%d): %v", w.ID, err)
+ log.Error("webhook.GetDiscordHook(%d): %v", w.ID, err)
}
return s
}
@@ -572,13 +572,13 @@ func (t *HookTask) AfterLoad() {
t.RequestInfo = &HookRequest{}
if err := json.Unmarshal([]byte(t.RequestContent), t.RequestInfo); err != nil {
- log.Error(3, "Unmarshal RequestContent[%d]: %v", t.ID, err)
+ log.Error("Unmarshal RequestContent[%d]: %v", t.ID, err)
}
if len(t.ResponseContent) > 0 {
t.ResponseInfo = &HookResponse{}
if err := json.Unmarshal([]byte(t.ResponseContent), t.ResponseInfo); err != nil {
- log.Error(3, "Unmarshal ResponseContent[%d]: %v", t.ID, err)
+ log.Error("Unmarshal ResponseContent[%d]: %v", t.ID, err)
}
}
}
@@ -586,7 +586,7 @@ func (t *HookTask) AfterLoad() {
func (t *HookTask) simpleMarshalJSON(v interface{}) string {
p, err := json.Marshal(v)
if err != nil {
- log.Error(3, "Marshal [%d]: %v", t.ID, err)
+ log.Error("Marshal [%d]: %v", t.ID, err)
}
return string(p)
}
@@ -666,7 +666,7 @@ func prepareWebhook(e Engine, w *Webhook, repo *Repository, event HookEventType,
if len(w.Secret) > 0 {
data, err := payloader.JSONPayload()
if err != nil {
- log.Error(2, "prepareWebhooks.JSONPayload: %v", err)
+ log.Error("prepareWebhooks.JSONPayload: %v", err)
}
sig := hmac.New(sha256.New, []byte(w.Secret))
sig.Write(data)
@@ -765,13 +765,13 @@ func (t *HookTask) deliver() {
}
if err := UpdateHookTask(t); err != nil {
- log.Error(4, "UpdateHookTask [%d]: %v", t.ID, err)
+ log.Error("UpdateHookTask [%d]: %v", t.ID, err)
}
// Update webhook last delivery status.
w, err := GetWebhookByID(t.HookID)
if err != nil {
- log.Error(5, "GetWebhookByID: %v", err)
+ log.Error("GetWebhookByID: %v", err)
return
}
if t.IsSucceed {
@@ -780,7 +780,7 @@ func (t *HookTask) deliver() {
w.LastStatus = HookStatusFail
}
if err = UpdateWebhookLastStatus(w); err != nil {
- log.Error(5, "UpdateWebhookLastStatus: %v", err)
+ log.Error("UpdateWebhookLastStatus: %v", err)
return
}
}()
@@ -813,7 +813,7 @@ func DeliverHooks() {
tasks := make([]*HookTask, 0, 10)
err := x.Where("is_delivered=?", false).Find(&tasks)
if err != nil {
- log.Error(4, "DeliverHooks: %v", err)
+ log.Error("DeliverHooks: %v", err)
return
}
@@ -829,13 +829,13 @@ func DeliverHooks() {
repoID, err := com.StrTo(repoIDStr).Int64()
if err != nil {
- log.Error(4, "Invalid repo ID: %s", repoIDStr)
+ log.Error("Invalid repo ID: %s", repoIDStr)
continue
}
tasks = make([]*HookTask, 0, 5)
if err := x.Where("repo_id=? AND is_delivered=?", repoID, false).Find(&tasks); err != nil {
- log.Error(4, "Get repository [%s] hook tasks: %v", repoID, err)
+ log.Error("Get repository [%d] hook tasks: %v", repoID, err)
continue
}
for _, t := range tasks {