Esempio n. 1
0
// 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))
}
Esempio n. 2
0
// logError prints an error with the call stack of the location it was reported
func logError(err error) {
	glog.ErrorDepth(2, err)
}
Esempio n. 3
0
// 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()
}
Esempio n. 4
0
File: glg.go Progetto: optimuse/ora
func (l gLgr) Errorln(v ...interface{}) {
	glog.ErrorDepth(2, v...)
}
Esempio n. 5
0
File: glg.go Progetto: optimuse/ora
func (l gLgr) Errorf(format string, v ...interface{}) {
	glog.ErrorDepth(2, fmt.Sprintf(format, v...))
}
Esempio n. 6
0
func (gl GLogger) Error(f string, a ...interface{}) {
	glog.ErrorDepth(3, fmt.Sprintf(f, a...))
}
Esempio n. 7
0
		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...)
Esempio n. 8
0
// ErrorDepth is part of the Logger interface.
func (cl *ConsoleLogger) ErrorDepth(depth int, s string) {
	log.ErrorDepth(1+depth, s)
}
Esempio n. 9
0
func (Logger) Errorf(format string, args ...interface{}) {
	glog.ErrorDepth(3, fmt.Sprintf(format, args...))
}
Esempio n. 10
0
// Errorf is part of the Logger interface
func (cl ConsoleLogger) Errorf(format string, v ...interface{}) {
	log.ErrorDepth(2, fmt.Sprintf(format, v...))
}
Esempio n. 11
0
func logErrorAndRedirect(w http.ResponseWriter, r *http.Request, redirectTo string, err error) {
	http.Redirect(w, r, redirectTo, http.StatusTemporaryRedirect)
	glog.ErrorDepth(1, err)
}
Esempio n. 12
0
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)
}
Esempio n. 13
0
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)
}