log: start using gopkg.in/clog.v1

This commit is contained in:
Unknwon
2017-02-09 19:29:59 -05:00
parent 8a19f8a63c
commit eb66060cd7
66 changed files with 198 additions and 1033 deletions

View File

@@ -22,10 +22,10 @@ import (
"github.com/Unknwon/com"
"github.com/Unknwon/i18n"
log "gopkg.in/clog.v1"
"github.com/gogits/chardet"
"github.com/gogits/gogs/modules/log"
"github.com/gogits/gogs/modules/setting"
)
@@ -52,17 +52,17 @@ func ShortSha(sha1 string) string {
func DetectEncoding(content []byte) (string, error) {
if utf8.Valid(content) {
log.Debug("Detected encoding: utf-8 (fast)")
log.Trace("Detected encoding: utf-8 (fast)")
return "UTF-8", nil
}
result, err := chardet.NewTextDetector().DetectBest(content)
if result.Charset != "UTF-8" && len(setting.Repository.AnsiCharset) > 0 {
log.Debug("Using default AnsiCharset: %s", setting.Repository.AnsiCharset)
log.Trace("Using default AnsiCharset: %s", setting.Repository.AnsiCharset)
return setting.Repository.AnsiCharset, err
}
log.Debug("Detected encoding: %s", result.Charset)
log.Trace("Detected encoding: %s", result.Charset)
return result.Charset, err
}