本文整理汇总了Golang中github.com/astaxie/beego/logs.BeeLogger.Info方法的典型用法代码示例。如果您正苦于以下问题:Golang BeeLogger.Info方法的具体用法?Golang BeeLogger.Info怎么用?Golang BeeLogger.Info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/astaxie/beego/logs.BeeLogger
的用法示例。
在下文中一共展示了BeeLogger.Info方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: UploadFile
func UploadFile(ctx *macaron.Context, log *logs.BeeLogger) (int, []byte) {
metaInfo, _, err := uploadFileReadParam(&ctx.Req.Header)
if err != nil {
log.Error("[OSS][uploadFile] read param error: %v", err)
return http.StatusBadRequest, []byte(err.Error())
}
data, err := ctx.Req.Body().Bytes()
if err != nil {
log.Error("[OSS]read request body error: %s", err)
return http.StatusBadRequest, []byte(err.Error())
}
statusCode, err := ossupload(data, metaInfo)
if err != nil {
log.Error("[OSS][uploadFile] upload error: %v", err)
return statusCode, []byte(err.Error())
}
if err = metaDriver.StoreMetaInfoV1(metaInfo); err != nil {
log.Error("[OSS]store metaInfo error: %s", err)
return http.StatusInternalServerError, []byte(err.Error())
}
log.Info("[OSS][postFile] success. path: %s, fragmentIndex: %d, bytesRange: %d-%d, isLast: %v", metaInfo.Path, metaInfo.Value.Index, metaInfo.Value.Start, metaInfo.Value.End, metaInfo.Value.IsLast)
return http.StatusOK, nil
}
示例2: HeadBlobsV2Handler
func HeadBlobsV2Handler(ctx *macaron.Context, log *logs.BeeLogger) (int, []byte) {
digest := ctx.Params(":digest")
tarsum := strings.Split(digest, ":")[1]
ctx.Resp.Header().Set("Content-Type", "application/json; charset=utf-8")
i := new(models.Image)
if exists, err := i.Get(tarsum); err != nil {
log.Info("[REGISTRY API V2] Failed to get tarsum %v: %v", tarsum, err.Error())
result, _ := json.Marshal(map[string]string{"message": "Failed to get tarsum"})
return http.StatusBadRequest, result
} else if !exists {
log.Info("[REGISTRY API V2] Not found tarsum: %v", tarsum)
result, _ := json.Marshal(map[string]string{"message": "Not found tarsum"})
return http.StatusNotFound, result
}
ctx.Resp.Header().Set("Content-Type", "application/octet-stream")
ctx.Resp.Header().Set("Docker-Content-Digest", digest)
ctx.Resp.Header().Set("Content-Length", fmt.Sprint(i.Size))
result, _ := json.Marshal(map[string]string{})
return http.StatusOK, result
}
示例3: ReceiveChunkserverInfo
func ReceiveChunkserverInfo(ctx *macaron.Context, log *logs.BeeLogger) (int, []byte) {
header := ctx.Req.Header
nodeip := header.Get("nodeip")
nodeport := header.Get("nodeport")
groupid := header.Get("groupid")
stderr := header.Get("stderr")
stdout := header.Get("stdout")
log.Info("[OSS]Chunkserver %s:%s groupid:%s start error", nodeip, nodeport, groupid)
log.Info("[OSS]STDOUT:%s", stdout)
log.Info("[OSS]STDERR:%s", stderr)
return http.StatusOK, []byte("information recieced")
}
示例4: DeleteFile
func DeleteFile(ctx *macaron.Context, log *logs.BeeLogger) (int, []byte) {
path := ctx.Req.Header.Get(headerPath)
log.Info("[OSS][deleteFile] path: %s", path)
var err error
if err = metaDriver.DeleteFileMetaInfoV1(path); err != nil {
log.Error("[OSS]delete metainfo error for path: %s, error: %s", path, err)
return http.StatusInternalServerError, []byte(err.Error())
}
log.Info("[OSS][deleteFile] success. path: %s", path)
return http.StatusNoContent, nil
}
示例5: HeadBlobsV2Handler
func HeadBlobsV2Handler(ctx *macaron.Context, log *logs.BeeLogger) (int, []byte) {
digest := ctx.Params(":digest")
tarsum := strings.Split(digest, ":")[1]
i := new(models.Image)
if has, _ := i.HasTarsum(tarsum); has == false {
log.Info("[REGISTRY API V2] Tarsum not found: %v", tarsum)
result, _ := json.Marshal(map[string]string{"message": "Tarsum not found"})
return http.StatusNotFound, result
}
ctx.Resp.Header().Set("Content-Type", "application/x-gzip")
ctx.Resp.Header().Set("Docker-Content-Digest", digest)
ctx.Resp.Header().Set("Content-Length", fmt.Sprint(i.Size))
result, _ := json.Marshal(map[string]string{})
return http.StatusOK, result
}
示例6: GetFileInfo
func GetFileInfo(ctx *macaron.Context, log *logs.BeeLogger) (int, []byte) {
path := ctx.Req.Header.Get(headerPath)
log.Info("[OSS][getFileInfo] Path: %s", path)
result, err := metaDriver.GetFileMetaInfo(path, false)
if err != nil {
log.Error("[OSS][getFileInfo] get metainfo error, key: %s, error: %s", path, err)
return http.StatusInternalServerError, []byte(err.Error())
}
if len(result) == 0 {
log.Info("[OSS][getFileInfo] metainfo not exists, key: %s", path)
return http.StatusNotFound, []byte(err.Error())
}
resultMap := make(map[string]interface{})
resultMap["fragment-info"] = result
jsonResult, err := json.Marshal(resultMap)
if err != nil {
log.Error("json.Marshal error, key: %s, error: %s", path, err)
return http.StatusInternalServerError, []byte(err.Error())
}
log.Info("[getFileInfo] success, path: %s, result: %s", path, string(jsonResult))
return http.StatusOK, jsonResult
}
示例7: DownloadFile
func DownloadFile(ctx *macaron.Context, log *logs.BeeLogger) (int, []byte) {
header := ctx.Req.Header
path := header.Get(headerPath)
fragmentIndex := header.Get(headerIndex)
bytesRange := header.Get(headerRange)
start, end, err := splitRange(bytesRange)
if err != nil {
log.Error("[OSS]splitRange error, bytesRange: %s, error: %s", bytesRange, err)
return http.StatusBadRequest, []byte(err.Error())
}
index, err := strconv.ParseUint(fragmentIndex, 10, 64)
if err != nil {
log.Error("[OSS]parser fragmentIndex: %s, error: %s", fragmentIndex, err)
return http.StatusBadRequest, []byte(err.Error())
}
log.Info("[OSS]path: %s, fragmentIndex: %d, bytesRange: %d-%d", path, index, start, end)
metaInfoValue := &meta.MetaInfoValue{
Index: index,
Start: start,
End: end,
}
metaInfo := &meta.MetaInfo{Path: path, Value: metaInfoValue}
log.Debug("[OSS]metaInfo: %s", metaInfo)
chunkServer, err := getOneNormalChunkServer(metaInfo)
if err != nil {
if err.Error() == "fragment metainfo not found" {
return http.StatusNotFound, []byte(err.Error())
} else {
return http.StatusInternalServerError, []byte(err.Error())
}
}
connPools := GetConnectionPools()
conn, err := connPools.GetConn(chunkServer)
log.Info("downloadFile getconnection success")
if err != nil {
log.Error("downloadFile getconnection error: %v", err)
return http.StatusInternalServerError, []byte(err.Error())
}
data, err := chunkServer.GetData(metaInfo.Value, conn.(*chunkserver.PooledConn))
if err != nil {
conn.Close()
connPools.ReleaseConn(conn)
checkErrorAndConnPool(err, chunkServer, connPools)
return http.StatusInternalServerError, []byte(err.Error())
}
log.Info("[OSS][downloadFile] success. path: %s, fragmentIndex: %d, bytesRange: %d-%d", path, index, start, end)
connPools.ReleaseConn(conn)
return http.StatusOK, data
}