Exemple #1
0
func logError(at string, err *httperr.Error) {
	l := log.WithFields(log.Fields{
		"ns":    "kernel",
		"at":    at,
		"state": "error",
	})

	if err.User() {
		l.WithField("count#error.user", 1).Warn(err.Error())
		return
	}

	err.Save()

	id := rand.Int31()

	l.WithFields(log.Fields{
		"id":          id,
		"count#error": 1,
	}).Warn(err.Error())

	for i, t := range err.Trace() {
		l.WithFields(log.Fields{
			"id":   id,
			"line": i,
		}).Warn(t)
	}
}
Exemple #2
0
func logError(log *logger.Logger, err *httperr.Error) {
	if err.User() {
		log.Log("state=error type=user message=%q", err.Error())
		return
	}

	err.Save()

	id := rand.Int31()

	log.Log("state=error id=%d message=%q", id, err.Error())

	for i, line := range err.Trace() {
		log.Log("state=error id=%d line=%d trace=%q", id, i, line)
	}
}