本文整理匯總了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))
}
示例2: logError
// logError prints an error with the call stack of the location it was reported
func logError(err error) {
glog.ErrorDepth(2, err)
}
示例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()
}
示例4: Errorln
func (l gLgr) Errorln(v ...interface{}) {
glog.ErrorDepth(2, v...)
}
示例5: Errorf
func (l gLgr) Errorf(format string, v ...interface{}) {
glog.ErrorDepth(2, fmt.Sprintf(format, v...))
}
示例6: Error
func (gl GLogger) Error(f string, a ...interface{}) {
glog.ErrorDepth(3, fmt.Sprintf(f, a...))
}
示例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...)
示例8: ErrorDepth
// ErrorDepth is part of the Logger interface.
func (cl *ConsoleLogger) ErrorDepth(depth int, s string) {
log.ErrorDepth(1+depth, s)
}
示例9: Errorf
func (Logger) Errorf(format string, args ...interface{}) {
glog.ErrorDepth(3, fmt.Sprintf(format, args...))
}
示例10: Errorf
// Errorf is part of the Logger interface
func (cl ConsoleLogger) Errorf(format string, v ...interface{}) {
log.ErrorDepth(2, fmt.Sprintf(format, v...))
}
示例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)
}
示例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)
}
示例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)
}