// 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)) }
// logError prints an error with the call stack of the location it was reported func logError(err error) { glog.ErrorDepth(2, err) }
// 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() }
func (l gLgr) Errorln(v ...interface{}) { glog.ErrorDepth(2, v...) }
func (l gLgr) Errorf(format string, v ...interface{}) { glog.ErrorDepth(2, fmt.Sprintf(format, v...)) }
func (gl GLogger) Error(f string, a ...interface{}) { glog.ErrorDepth(3, fmt.Sprintf(f, a...)) }
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...)
// ErrorDepth is part of the Logger interface. func (cl *ConsoleLogger) ErrorDepth(depth int, s string) { log.ErrorDepth(1+depth, s) }
func (Logger) Errorf(format string, args ...interface{}) { glog.ErrorDepth(3, fmt.Sprintf(format, args...)) }
// Errorf is part of the Logger interface func (cl ConsoleLogger) Errorf(format string, v ...interface{}) { log.ErrorDepth(2, fmt.Sprintf(format, v...)) }
func logErrorAndRedirect(w http.ResponseWriter, r *http.Request, redirectTo string, err error) { http.Redirect(w, r, redirectTo, http.StatusTemporaryRedirect) glog.ErrorDepth(1, err) }
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) }
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) }