1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Cleanup log messaging

This change corrects a few logging issues:

 * Standardized formatting errors with '%v'.
 * Standardized failure warning word usage.
 * Corrected an instance of using the standard log library when
   the gitea log library should be used instead.
This commit is contained in:
Gabriel Jackson
2017-01-29 12:13:57 -08:00
committed by Kim "BKC" Carlbäcker
parent 73d05a51e3
commit bf6f61cc69
26 changed files with 111 additions and 112 deletions

View File

@@ -151,7 +151,7 @@ func (w *FileLogWriter) initFd() error {
fd := w.mw.fd
finfo, err := fd.Stat()
if err != nil {
return fmt.Errorf("get stat: %s", err)
return fmt.Errorf("get stat: %v", err)
}
w.maxsizeCursize = int(finfo.Size())
w.dailyOpenDate = time.Now().Day()
@@ -194,12 +194,12 @@ func (w *FileLogWriter) DoRotate() error {
// close fd before rename
// Rename the file to its newfound home
if err = os.Rename(w.Filename, fname); err != nil {
return fmt.Errorf("Rotate: %s", err)
return fmt.Errorf("Rotate: %v", err)
}
// re-start logger
if err = w.StartLogger(); err != nil {
return fmt.Errorf("Rotate StartLogger: %s", err)
return fmt.Errorf("Rotate StartLogger: %v", err)
}
go w.deleteOldLog()
@@ -221,7 +221,7 @@ func (w *FileLogWriter) deleteOldLog() {
if strings.HasPrefix(filepath.Base(path), filepath.Base(w.Filename)) {
if err := os.Remove(path); err != nil {
returnErr = fmt.Errorf("Fail to remove %s: %v", path, err)
returnErr = fmt.Errorf("Failed to remove %s: %v", path, err)
}
}
}