UX: Reduce some levels to keep logs clean

Signed-off-by: Michael Mayer <michael@liquidbytes.net>
This commit is contained in:
Michael Mayer 2020-07-14 11:48:59 +02:00
parent 4cf4c1973d
commit 7a7c5aa190
3 changed files with 10 additions and 24 deletions

View file

@ -123,7 +123,7 @@ func FirstOrCreatePerson(m *Person) *Person {
if err := Db().Where("id = ? OR person_uid = ?", m.ID, m.PersonUID).First(&result).Error; err == nil {
return &result
} else if err := m.Create(); err != nil {
log.Errorf("person: %s", err)
log.Debugf("person: %s", err)
return nil
}
@ -141,7 +141,7 @@ func FindPersonByUserName(userName string) *Person {
if err := Db().Where("user_name = ?", userName).First(&result).Error; err == nil {
return &result
} else {
log.Errorf("user %s not found", txt.Quote(userName))
log.Debugf("user %s not found", txt.Quote(userName))
return nil
}
}
@ -157,7 +157,7 @@ func FindPersonByUID(uid string) *Person {
if err := Db().Where("person_uid = ?", uid).First(&result).Error; err == nil {
return &result
} else {
log.Errorf("user %s not found", txt.Quote(uid))
log.Debugf("user %s not found", txt.Quote(uid))
return nil
}
}

View file

@ -29,20 +29,12 @@ func Logger() gin.HandlerFunc {
path = path + "?" + raw
}
if statusCode >= 400 {
log.Errorf("%s %s (%3d) [%v]",
method,
path,
statusCode,
latency,
)
} else {
log.Debugf("%s %s (%3d) [%v]",
method,
path,
statusCode,
latency,
)
}
// Use debug level to keep production logs clean.
log.Debugf("%s %s (%3d) [%v]",
method,
path,
statusCode,
latency,
)
}
}

View file

@ -7,7 +7,6 @@ import (
"net/http"
"net/http/httputil"
"runtime"
"time"
"github.com/gin-gonic/gin"
)
@ -94,8 +93,3 @@ func function(pc uintptr) []byte {
name = bytes.Replace(name, centerDot, dot, -1)
return name
}
func timeFormat(t time.Time) string {
var timeString = t.Format("2006/01/02 - 15:04:05")
return timeString
}