-
Notifications
You must be signed in to change notification settings - Fork 225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Output error and warning log #717
Conversation
fileserver/fileop.go
Outdated
@@ -763,7 +763,7 @@ func doBlock(rsp http.ResponseWriter, r *http.Request, repo *repomgr.Repo, fileI | |||
err = blockmgr.Read(repo.StoreID, blkID, rsp) | |||
if err != nil { | |||
if !isNetworkErr(err) { | |||
log.Printf("failed to read block %s: %v", blkID, err) | |||
log.Warnf("failed to read block %s: %v", blkID, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
上面这些读取 block 失败应该都属于 error 吧。
fileserver/fileop.go
Outdated
return err | ||
} | ||
header := map[string][]string{ | ||
"Authorization": {"Token " + token}, | ||
} | ||
_, _, err = utils.HttpCommon("POST", url, header, bytes.NewReader(msg)) | ||
if err != nil { | ||
log.Printf("failed to send repo update event: %v", err) | ||
log.Errorf("failed to send repo update event: %v", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个函数里面,发送通知失败属于不那么重要的错误,可以用 warn。
fileserver/fileop.go
Outdated
@@ -1232,7 +1232,7 @@ func doUpload(rsp http.ResponseWriter, r *http.Request, fsm *recvData, isAjax bo | |||
success := "{\"success\": true}" | |||
_, err := rsp.Write([]byte(success)) | |||
if err != nil { | |||
log.Printf("failed to write data to response") | |||
log.Warnf("failed to write data to response") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个错误可以不用打印了,因为这个可能是客户端断开连接。
fileserver/fileop.go
Outdated
@@ -3015,7 +3015,7 @@ func doUpdate(rsp http.ResponseWriter, r *http.Request, fsm *recvData, isAjax bo | |||
success := "{\"success\": true}" | |||
_, err := rsp.Write([]byte(success)) | |||
if err != nil { | |||
log.Printf("failed to write data to response.\n") | |||
log.Warnf("failed to write data to response.\n") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个日志也不用打印了。
fileserver/sync_api.go
Outdated
@@ -851,7 +851,7 @@ func getBlockInfo(rsp http.ResponseWriter, r *http.Request) *appError { | |||
rsp.Header().Set("Content-Length", blockLen) | |||
if err := blockmgr.Read(storeID, blockID, rsp); err != nil { | |||
if !isNetworkErr(err) { | |||
log.Printf("failed to read block %s: %v", blockID, err) | |||
log.Warnf("failed to read block %s: %v", blockID, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个也应该是 error.
fileserver/sync_api.go
Outdated
@@ -914,7 +914,7 @@ func publishStatusEvent(rData *statusEventData) { | |||
rData.eType, rData.user, | |||
rData.repoID, rData.bytes) | |||
if _, err := rpcclient.Call("publish_event", seafileServerChannelStats, buf); err != nil { | |||
log.Printf("Failed to publish event: %v", err) | |||
log.Errorf("Failed to publish event: %v", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个 warn 就可以了。
fileserver/sync_api.go
Outdated
@@ -988,7 +988,7 @@ func getCommitInfo(rsp http.ResponseWriter, r *http.Request) *appError { | |||
return appErr | |||
} | |||
if exists, _ := commitmgr.Exists(repoID, commitID); !exists { | |||
log.Printf("%s:%s is missing", repoID, commitID) | |||
log.Warnf("%s:%s is missing", repoID, commitID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个日志不用打印。
fileserver/sync_api.go
Outdated
@@ -1246,7 +1246,7 @@ func onRepoOper(eType, repoID, user, ip, clientName string) { | |||
vInfo, err := repomgr.GetVirtualRepoInfo(repoID) | |||
|
|||
if err != nil { | |||
log.Printf("Failed to get virtual repo info by repo id %s: %v", repoID, err) | |||
log.Warnf("Failed to get virtual repo info by repo id %s: %v", repoID, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个也应该是 error 吧。
fileserver/sync_api.go
Outdated
} | ||
} | ||
|
||
func publishUpdateEvent(repoID string, commitID string) { | ||
buf := fmt.Sprintf("repo-update\t%s\t%s", repoID, commitID) | ||
if _, err := rpcclient.Call("publish_event", seafileServerChannelEvent, buf); err != nil { | ||
log.Printf("Failed to publish event: %v", err) | ||
log.Errorf("Failed to publish event: %v", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
上面这两个改为 warn。
No description provided.