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