當前位置: 首頁>>代碼示例>>Golang>>正文


Golang glog.ErrorDepth函數代碼示例

本文整理匯總了Golang中github.com/golang/glog.ErrorDepth函數的典型用法代碼示例。如果您正苦於以下問題:Golang ErrorDepth函數的具體用法?Golang ErrorDepth怎麽用?Golang ErrorDepth使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了ErrorDepth函數的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: Errorf

// Errorf logs an error message with caller information.
func Errorf(format string, args ...interface{}) {
	msg := format
	if len(args) > 0 {
		msg = fmt.Sprintf(format, args...)
	}

	log.ErrorDepth(1, fmt.Sprintf("%s: %s", funcName(), msg))
}
開發者ID:eolexe,項目名稱:martian,代碼行數:9,代碼來源:log.go

示例2: logError

// logError prints an error with the call stack of the location it was reported
func logError(err error) {
	glog.ErrorDepth(2, err)
}
開發者ID:CodeJuan,項目名稱:kubernetes,代碼行數:4,代碼來源:runtime.go

示例3: Fatalf

// Fatalf implements log.Fatalf for a Suite and fails the current test and suite.
func (t *Suite) Fatalf(format string, args ...interface{}) {
	t.failed = true
	t.msg = t.getFileLine() + " " + fmt.Sprintf(format, args...)
	log.ErrorDepth(1, fmt.Sprintf(format, args...))
	t.t.FailNow()
}
開發者ID:mehulsbhatt,項目名稱:drydock,代碼行數:7,代碼來源:test_suite.go

示例4: Errorln

func (l gLgr) Errorln(v ...interface{}) {
	glog.ErrorDepth(2, v...)
}
開發者ID:optimuse,項目名稱:ora,代碼行數:3,代碼來源:glg.go

示例5: Errorf

func (l gLgr) Errorf(format string, v ...interface{}) {
	glog.ErrorDepth(2, fmt.Sprintf(format, v...))
}
開發者ID:optimuse,項目名稱:ora,代碼行數:3,代碼來源:glg.go

示例6: Error

func (gl GLogger) Error(f string, a ...interface{}) {
	glog.ErrorDepth(3, fmt.Sprintf(f, a...))
}
開發者ID:codingjester,項目名稱:goirc,代碼行數:3,代碼來源:glog.go

示例7: newSyslogAdapter

		Warnf:  func(format string, v ...interface{}) { log.Printf("WARN: "+format, v...) },
		Errorf: func(format string, v ...interface{}) { log.Printf("ERROR: "+format, v...) },
		Fatalf: func(format string, v ...interface{}) { log.Fatalf("FATAL: "+format, v...) },
		Panicf: func(format string, v ...interface{}) { log.Panicf("FATAL: "+format, v...) },
	}

	GLogAdapter = &LoggingAdapter{
		Debugf: glog.V(2).Infof,
		Infof:  glog.V(1).Infof,
		Warnf:  glog.Warningf,
		Errorf: glog.Errorf,
		Fatalf: glog.Fatalf,
		Panicf: func(format string, v ...interface{}) {
			s := fmt.Sprintf(format, v...)

			glog.ErrorDepth(1, s)

			panic(s)
		},
	}
)

func newSyslogAdapter(w *syslog.Writer) *LoggingAdapter {
	return &LoggingAdapter{
		Debugf: func(format string, v ...interface{}) { w.Debug(fmt.Sprintf(format, v...)) },
		Infof:  func(format string, v ...interface{}) { w.Info(fmt.Sprintf(format, v...)) },
		Warnf:  func(format string, v ...interface{}) { w.Warning(fmt.Sprintf(format, v...)) },
		Errorf: func(format string, v ...interface{}) { w.Err(fmt.Sprintf(format, v...)) },
		Fatalf: func(format string, v ...interface{}) {
			s := fmt.Sprintf(format, v...)
開發者ID:flier,項目名稱:go.server,代碼行數:30,代碼來源:logging.go

示例8: ErrorDepth

// ErrorDepth is part of the Logger interface.
func (cl *ConsoleLogger) ErrorDepth(depth int, s string) {
	log.ErrorDepth(1+depth, s)
}
開發者ID:aaijazi,項目名稱:vitess,代碼行數:4,代碼來源:console_logger.go

示例9: Errorf

func (Logger) Errorf(format string, args ...interface{}) {
	glog.ErrorDepth(3, fmt.Sprintf(format, args...))
}
開發者ID:RamboWANG,項目名稱:cayley,代碼行數:3,代碼來源:glog.go

示例10: Errorf

// Errorf is part of the Logger interface
func (cl ConsoleLogger) Errorf(format string, v ...interface{}) {
	log.ErrorDepth(2, fmt.Sprintf(format, v...))
}
開發者ID:littleyang,項目名稱:vitess,代碼行數:4,代碼來源:console_logger.go

示例11: logErrorAndRedirect

func logErrorAndRedirect(w http.ResponseWriter, r *http.Request, redirectTo string, err error) {
	http.Redirect(w, r, redirectTo, http.StatusTemporaryRedirect)
	glog.ErrorDepth(1, err)
}
開發者ID:autograde,項目名稱:srv,代碼行數:4,代碼來源:logerror.go

示例12: logNotFoundError

func logNotFoundError(w http.ResponseWriter, err error) {
	errCode := rand.Uint32()
	errMsg := fmt.Sprintf("NotFound(%d)", errCode)
	http.Error(w, errMsg, http.StatusNotFound)
	glog.ErrorDepth(1, errMsg, ": ", err)
}
開發者ID:autograde,項目名稱:srv,代碼行數:6,代碼來源:logerror.go

示例13: logServerError

func logServerError(w http.ResponseWriter, err error) {
	errCode := rand.Uint32()
	errMsg := fmt.Sprintf("InternalServerError(%d)", errCode)
	http.Error(w, errMsg, http.StatusInternalServerError)
	glog.ErrorDepth(2, errMsg, ": ", err)
}
開發者ID:autograde,項目名稱:srv,代碼行數:6,代碼來源:logerror.go


注:本文中的github.com/golang/glog.ErrorDepth函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。