当前位置: 首页>>代码示例>>Golang>>正文


Golang BeeLogger.Debug方法代码示例

本文整理汇总了Golang中github.com/astaxie/beego/logs.BeeLogger.Debug方法的典型用法代码示例。如果您正苦于以下问题:Golang BeeLogger.Debug方法的具体用法?Golang BeeLogger.Debug怎么用?Golang BeeLogger.Debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/astaxie/beego/logs.BeeLogger的用法示例。


在下文中一共展示了BeeLogger.Debug方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: PutImageChecksumV1Handler

func PutImageChecksumV1Handler(ctx *macaron.Context, log *logs.BeeLogger) (int, []byte) {
	imageId := ctx.Params(":imageId")

	checksum := strings.Split(ctx.Req.Header.Get("X-Docker-Checksum"), ":")[1]
	payload := strings.Split(ctx.Req.Header.Get("X-Docker-Checksum-Payload"), ":")[1]

	log.Debug("[REGISTRY API V1] Image Checksum : %v", checksum)
	log.Debug("[REGISTRY API V1] Image Payload: %v", payload)

	i := new(models.Image)
	if err := i.PutChecksum(imageId, checksum, true, payload); err != nil {
		log.Error("[REGISTRY API V1] Put Image Checksum & Payload Error: %v", err.Error())

		result, _ := json.Marshal(map[string]string{"message": "Put Image Checksum & Payload Error"})
		return http.StatusBadRequest, result
	}

	if err := i.PutAncestry(imageId); err != nil {
		log.Error("[REGISTRY API V1] Put Image Ancestry Error: %v", err.Error())

		result, _ := json.Marshal(map[string]string{"message": "Put Image Ancestry Error"})
		return http.StatusBadRequest, result
	}

	result, _ := json.Marshal(map[string]string{})
	return http.StatusOK, result
}
开发者ID:pombredanne,项目名称:wharf-1,代码行数:27,代码来源:image.go

示例2: 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
}
开发者ID:maquanyi,项目名称:dockyard,代码行数:56,代码来源:handler.go

示例3: PutTagV1Handler

func PutTagV1Handler(ctx *macaron.Context, log *logs.BeeLogger) (int, []byte) {
	namespace := ctx.Params(":namespace")
	repository := ctx.Params(":repository")
	tag := ctx.Params(":tag")

	bodystr, _ := ctx.Req.Body().String()
	log.Debug("[REGISTRY API V1] Repository Tag : %v", bodystr)

	r, _ := regexp.Compile(`"([[:alnum:]]+)"`)
	imageIds := r.FindStringSubmatch(bodystr)

	repo := new(models.Repository)
	if err := repo.PutTag(imageIds[1], namespace, repository, tag); err != nil {
		log.Error("[REGISTRY API V1] Put repository tag error: %v", err.Error())

		result, _ := json.Marshal(map[string]string{"message": err.Error()})
		return http.StatusBadRequest, result
	}

	result, _ := json.Marshal(map[string]string{})
	return http.StatusOK, result
}
开发者ID:CodeJuan,项目名称:dockyard,代码行数:22,代码来源:repository.go


注:本文中的github.com/astaxie/beego/logs.BeeLogger.Debug方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。