• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang glog.Errorln函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/skia-dev/glog.Errorln函数的典型用法代码示例。如果您正苦于以下问题:Golang Errorln函数的具体用法?Golang Errorln怎么用?Golang Errorln使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: clHandler

// clHandler serves the HTML for the /cl/<id> page.
//
// These are shortcuts to individual clusters.
//
// See alertingHandler for the JSON it uses.
//
func clHandler(w http.ResponseWriter, r *http.Request) {
	w.Header().Set("Content-Type", "text/html")
	if *local {
		loadTemplates()
	}

	match := clHandlerPath.FindStringSubmatch(r.URL.Path)
	if r.Method != "GET" || match == nil || len(match) != 2 {
		http.NotFound(w, r)
		return
	}
	id, err := strconv.ParseInt(match[1], 10, 0)
	if err != nil {
		util.ReportError(w, r, err, "Failed parsing ID.")
		return
	}
	cl, err := alerting.Get(id)
	if err != nil {
		util.ReportError(w, r, err, "Failed to find cluster with that ID.")
		return
	}
	if err := templates.ExecuteTemplate(w, "cl.html", cl); err != nil {
		glog.Errorln("Failed to expand template:", err)
	}
}
开发者ID:saltmueller,项目名称:skia-buildbot,代码行数:31,代码来源:main.go


示例2: activityHandler

// activityHandler serves the HTML for the /activitylog/ page.
//
// If an optional number n is appended to the path, returns the most recent n
// activities. Otherwise returns the most recent 100 results.
//
func activityHandler(w http.ResponseWriter, r *http.Request) {
	w.Header().Set("Content-Type", "text/html")
	if *local {
		loadTemplates()
	}

	match := activityHandlerPath.FindStringSubmatch(r.URL.Path)
	if r.Method != "GET" || match == nil || len(match) != 2 {
		http.NotFound(w, r)
		return
	}
	n := 100
	if len(match[1]) > 0 {
		num, err := strconv.ParseInt(match[1], 10, 0)
		if err != nil {
			util.ReportError(w, r, err, "Failed parsing the given number.")
			return
		}
		n = int(num)
	}
	a, err := activitylog.GetRecent(n)
	if err != nil {
		util.ReportError(w, r, err, "Failed to retrieve activity.")
		return
	}
	if err := templates.ExecuteTemplate(w, "activitylog.html", a); err != nil {
		glog.Errorln("Failed to expand template:", err)
	}
}
开发者ID:saltmueller,项目名称:skia-buildbot,代码行数:34,代码来源:main.go


示例3: clustersHandler

// clustersHandler handles the GET of the clusters page.
func clustersHandler(w http.ResponseWriter, r *http.Request) {
	glog.Infof("Cluster Handler: %q\n", r.URL.Path)
	w.Header().Set("Content-Type", "text/html")
	if err := clusterTemplate.Execute(w, nil); err != nil {
		glog.Errorln("Failed to expand template:", err)
	}
}
开发者ID:kleopatra999,项目名称:skia-buildbot,代码行数:8,代码来源:main.go


示例4: mainHandler

// mainHandler handles the GET of the main page.
func mainHandler(w http.ResponseWriter, r *http.Request) {
	glog.Infof("Main Handler: %q\n", r.URL.Path)
	if r.Method == "GET" {
		w.Header().Set("Content-Type", "text/html")
		if err := indexTemplate.Execute(w, struct{}{}); err != nil {
			glog.Errorln("Failed to expand template:", err)
		}
	}
}
开发者ID:kleopatra999,项目名称:skia-buildbot,代码行数:10,代码来源:main.go


示例5: helpHandler

// helpHandler handles the GET of the main page.
func helpHandler(w http.ResponseWriter, r *http.Request) {
	glog.Infof("Help Handler: %q\n", r.URL.Path)
	if r.Method == "GET" {
		w.Header().Set("Content-Type", "text/html")
		ctx := parser.NewContext(nil)
		if err := helpTemplate.Execute(w, ctx); err != nil {
			glog.Errorln("Failed to expand template:", err)
		}
	}
}
开发者ID:kleopatra999,项目名称:skia-buildbot,代码行数:11,代码来源:main.go


示例6: mainHandler

// mainHandler handles the GET of the main page.
func mainHandler(w http.ResponseWriter, r *http.Request) {
	if *local {
		loadTemplates()
	}
	if r.Method == "GET" {
		w.Header().Set("Content-Type", "text/html")
		if err := indexTemplate.Execute(w, struct{}{}); err != nil {
			glog.Errorln("Failed to expand template:", err)
		}
	}
}
开发者ID:kleopatra999,项目名称:skia-buildbot,代码行数:12,代码来源:main.go


示例7: templateHandler

func templateHandler(name string) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		w.Header().Set("Content-Type", "text/html")
		if *local {
			loadTemplates()
		}
		if err := templates.ExecuteTemplate(w, name, struct{}{}); err != nil {
			glog.Errorln("Failed to expand template:", err)
		}
	}
}
开发者ID:saltmueller,项目名称:skia-buildbot,代码行数:11,代码来源:main.go


示例8: rulesHandler

func rulesHandler(w http.ResponseWriter, r *http.Request) {
	w.Header().Set("Content-Type", "text/html")

	// Don't use cached templates in testing mode.
	if *testing {
		reloadTemplates()
	}

	if err := rulesTemplate.Execute(w, struct{}{}); err != nil {
		glog.Errorln("Failed to expand template:", err)
	}
}
开发者ID:Tiger66639,项目名称:skia-buildbot,代码行数:12,代码来源:main.go


示例9: alertResetHandler

// alertResetHandler deletes all the non-Bug alerts.
//
func alertResetHandler(w http.ResponseWriter, r *http.Request) {
	glog.Infof("AlertResetHandler: %q\n", r.URL.Path)
	if login.LoggedInAs(r) == "" {
		util.ReportError(w, r, fmt.Errorf("Not logged in."), "You must be logged in to change an alert status.")
		return
	}
	if r.Method != "POST" {
		http.NotFound(w, r)
		return
	}
	if err := alerting.Reset(); err != nil {
		glog.Errorln("Failed to delete all non-Bug alerts:", err)
	}
	http.Redirect(w, r, "/alerts/", 303)
}
开发者ID:saltmueller,项目名称:skia-buildbot,代码行数:17,代码来源:main.go


示例10: mainHandler

func mainHandler(w http.ResponseWriter, r *http.Request) {
	w.Header().Set("Content-Type", "text/html")

	// Don't use cached templates in testing mode.
	if *testing {
		reloadTemplates()
	}
	mainPage := struct {
		ProjectName string
		ProjectUser string
	}{
		ProjectName: *childName,
		ProjectUser: arb.User(),
	}
	if err := mainTemplate.Execute(w, mainPage); err != nil {
		glog.Errorln("Failed to expand template:", err)
	}
}
开发者ID:saltmueller,项目名称:skia-buildbot,代码行数:18,代码来源:main.go


示例11: mainHandler

// mainHandler handles the GET of the main page.
func mainHandler(w http.ResponseWriter, r *http.Request) {
	if r.Method == "GET" {
		if *local {
			loadResouces()
		}
		units, err := listUnits()
		if err != nil {
			util.ReportError(w, r, err, "Failed to list units.")
			return
		}
		context := &IndexBody{
			Hostname: hostname,
			Units:    units,
		}
		w.Header().Set("Content-Type", "text/html")
		if err := indexTemplate.ExecuteTemplate(w, "index.html", context); err != nil {
			glog.Errorln("Failed to expand template:", err)
		}
	}
}
开发者ID:kleopatra999,项目名称:skia-buildbot,代码行数:21,代码来源:main.go


示例12: search2Handler

func search2Handler(w http.ResponseWriter, r *http.Request) {
	w.Header().Set("Content-Type", "text/html")
	if *local {
		loadTemplates()
	}
	digests, numMatches, commits, err := search.Search(queryFromRequest(r), storages, tallies, blamer, paramsetSum)
	if err != nil {
		util.ReportError(w, r, err, "Search for digests failed.")
	}
	js, err := json.MarshalIndent(digests, "", "  ")
	if err != nil {
		util.ReportError(w, r, err, "Failed to encode response data.")
		return
	}
	commitsjs, err := json.MarshalIndent(commits, "", "  ")
	if err != nil {
		util.ReportError(w, r, err, "Failed to encode commits.")
		return
	}

	context := struct {
		Digests    []*search.Digest
		JS         template.JS
		CommitsJS  template.JS
		NumMatches int
	}{
		Digests:    digests,
		JS:         template.JS(string(js)),
		CommitsJS:  template.JS(string(commitsjs)),
		NumMatches: numMatches,
	}

	if err := templates.ExecuteTemplate(w, "search2.html", context); err != nil {
		glog.Errorln("Failed to expand template:", err)
	}
}
开发者ID:saltmueller,项目名称:skia-buildbot,代码行数:36,代码来源:main2.go


示例13: mainHandler

// mainHandler handles the GET of the main page.
//
// Handles servering all the processed Markdown documents
// and other assetts in the doc repo.
func mainHandler(w http.ResponseWriter, r *http.Request) {
	glog.Infof("Main Handler: %q\n", r.URL.Path)

	// If the request begins with /_/ then it is an XHR request and we only need
	// to return the content and not the surrounding markup.
	bodyOnly := false
	if strings.HasPrefix(r.URL.Path, "/_/") {
		bodyOnly = true
		r.URL.Path = r.URL.Path[2:]
	}

	d := primary
	// If there is a cl={issue_number} query parameter supplied then
	// clone a new copy of the docs repo and patch that issue into it,
	// and then serve this reqeust from that patched repo.
	cl := r.FormValue("cl")
	if cl != "" {
		issue, err := strconv.ParseInt(cl, 10, 64)
		if err != nil {
			util.ReportError(w, r, err, "The CL given is not valid.")
			return
		}
		d, err = docset.NewDocSetForIssue(filepath.Join(*workDir, "patches"), filepath.Join(*workDir, "primary"), issue)
		if err != nil {
			util.ReportError(w, r, err, "Failed to load the given CL")
			return
		}
	}

	// When running in local mode reload all templates and rebuild the navigation
	// menu on every request, so we don't have to start and stop the server while
	// developing.
	if *local {
		d.BuildNavigation()
		loadTemplates()
	}

	filename, raw, err := d.RawFilename(r.URL.Path)
	if err != nil {
		glog.Infof("Request for unknown path: %s", r.URL.Path)
		http.NotFound(w, r)
		return
	}

	// Set the content type.
	mimetype := "text/html"
	if raw {
		mimetype = mime.TypeByExtension(filepath.Ext(filename))
	}
	w.Header().Set("Content-Type", mimetype)

	// Write the response.
	b, err := d.Body(filename)
	if err != nil {
		util.ReportError(w, r, err, "Failed to load file")
		return
	}
	if raw {
		if _, err := w.Write(b); err != nil {
			glog.Errorf("Failed to write output: %s", err)
			return
		}
	} else {
		body := blackfriday.MarkdownCommon(b)
		if bodyOnly {
			if _, err := w.Write(body); err != nil {
				glog.Errorf("Failed to write output: %s", err)
				return
			}
		} else {
			content := &Content{
				Body: string(body),
				Nav:  d.Navigation(),
			}
			if err := indexTemplate.Execute(w, content); err != nil {
				glog.Errorln("Failed to expand template:", err)
			}
		}
	}
}
开发者ID:Tiger66639,项目名称:skia-buildbot,代码行数:84,代码来源:main.go


示例14: ReportError

// ReportError formats an HTTP error response and also logs the detailed error message.
func ReportError(w http.ResponseWriter, r *http.Request, err error, message string) {
	glog.Errorln(message, err)
	http.Error(w, fmt.Sprintf("%s %s", message, err), 500)
}
开发者ID:kleopatra999,项目名称:skia-buildbot,代码行数:5,代码来源:http.go


示例15: byBlameHandler

// byBlameHandler returns a page with the digests to be triaged grouped by blamelist.
func byBlameHandler(w http.ResponseWriter, r *http.Request) {
	w.Header().Set("Content-Type", "text/html")
	if *local {
		loadTemplates()
	}
	tile, sum, err := allUntriagedSummaries()
	commits := tile.Commits
	if err != nil {
		util.ReportError(w, r, err, "Failed to load summaries.")
		return
	}

	// This is a very simple grouping of digests, for every digest we look up the
	// blame list for that digest and then use the concatenated git hashes as a
	// group id. All of the digests are then grouped by their group id.

	// Collects a ByBlame for each untriaged digest, keyed by group id.
	grouped := map[string][]*ByBlame{}

	// The Commit info for each group id.
	commitinfo := map[string][]*tiling.Commit{}
	// map [groupid] [test] TestRollup
	rollups := map[string]map[string]*TestRollup{}

	for test, s := range sum {
		for _, d := range s.UntHashes {
			dist := blamer.GetBlame(test, d, commits)
			groupid := strings.Join(lookUpCommits(dist.Freq, commits), ":")
			// Only fill in commitinfo for each groupid only once.
			if _, ok := commitinfo[groupid]; !ok {
				ci := []*tiling.Commit{}
				for _, index := range dist.Freq {
					ci = append(ci, commits[index])
				}
				sort.Sort(CommitSlice(ci))
				commitinfo[groupid] = ci
			}
			// Construct a ByBlame and add it to grouped.
			value := &ByBlame{
				Test:          test,
				Digest:        d,
				Blame:         dist,
				CommitIndices: dist.Freq,
			}
			if _, ok := grouped[groupid]; !ok {
				grouped[groupid] = []*ByBlame{value}
			} else {
				grouped[groupid] = append(grouped[groupid], value)
			}
			if _, ok := rollups[groupid]; !ok {
				rollups[groupid] = map[string]*TestRollup{}
			}
			// Calculate the rollups.
			if _, ok := rollups[groupid][test]; !ok {
				rollups[groupid][test] = &TestRollup{
					Test:         test,
					Num:          0,
					SampleDigest: d,
				}
			}
			rollups[groupid][test].Num += 1
		}
	}

	// The Commit info needs to be accessed via Javascript, so serialize it into
	// JSON here.
	commitinfojs, err := json.MarshalIndent(commitinfo, "", "  ")
	if err != nil {
		util.ReportError(w, r, err, "Failed to encode response data.")
		return
	}

	keys := []string{}
	for groupid, _ := range grouped {
		keys = append(keys, groupid)
	}
	sort.Strings(keys)

	if err := templates.ExecuteTemplate(w, "byblame.html",
		struct {
			Keys      []string
			ByBlame   map[string][]*ByBlame
			CommitsJS template.JS

			// map [groupid] [testname]
			TestRollups map[string]map[string]*TestRollup
		}{
			Keys:        keys,
			ByBlame:     grouped,
			CommitsJS:   template.JS(string(commitinfojs)),
			TestRollups: rollups,
		}); err != nil {
		glog.Errorln("Failed to expand template:", err)
	}
}
开发者ID:saltmueller,项目名称:skia-buildbot,代码行数:96,代码来源:main2.go



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang glog.Fatal函数代码示例发布时间:2022-05-28
下一篇:
Golang glog.Errorf函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap