diff options
Diffstat (limited to 'routers')
-rw-r--r-- | routers/admin/admin.go | 8 | ||||
-rw-r--r-- | routers/admin/auths.go | 2 | ||||
-rw-r--r-- | routers/admin/notice.go | 2 | ||||
-rw-r--r-- | routers/admin/repos.go | 3 | ||||
-rw-r--r-- | routers/admin/users.go | 2 | ||||
-rw-r--r-- | routers/api/v1/admin/user.go | 3 | ||||
-rw-r--r-- | routers/api/v1/repo/repo.go | 3 | ||||
-rw-r--r-- | routers/install.go | 3 | ||||
-rw-r--r-- | routers/org/members.go | 2 | ||||
-rw-r--r-- | routers/org/org.go | 3 | ||||
-rw-r--r-- | routers/org/setting.go | 3 | ||||
-rw-r--r-- | routers/org/teams.go | 2 | ||||
-rw-r--r-- | routers/repo/branch.go | 3 | ||||
-rw-r--r-- | routers/repo/editor.go | 3 | ||||
-rw-r--r-- | routers/repo/http.go | 19 | ||||
-rw-r--r-- | routers/repo/issue.go | 2 | ||||
-rw-r--r-- | routers/repo/pull.go | 2 | ||||
-rw-r--r-- | routers/repo/release.go | 3 | ||||
-rw-r--r-- | routers/repo/repo.go | 2 | ||||
-rw-r--r-- | routers/repo/setting.go | 3 | ||||
-rw-r--r-- | routers/repo/view.go | 2 | ||||
-rw-r--r-- | routers/user/auth.go | 2 | ||||
-rw-r--r-- | routers/user/setting.go | 2 |
23 files changed, 47 insertions, 32 deletions
diff --git a/routers/admin/admin.go b/routers/admin/admin.go index e0eb9256..36872c7e 100644 --- a/routers/admin/admin.go +++ b/routers/admin/admin.go @@ -5,6 +5,7 @@ package admin import ( + "encoding/json" "fmt" "runtime" "strings" @@ -232,7 +233,12 @@ func Config(ctx *context.Context) { } loggers := make([]*logger, len(setting.LogModes)) for i := range setting.LogModes { - loggers[i] = &logger{setting.LogModes[i], setting.LogConfigs[i]} + loggers[i] = &logger{ + Mode: strings.Title(setting.LogModes[i]), + } + + result, _ := json.Marshal(setting.LogConfigs[i]) + loggers[i].Config = string(result) } ctx.Data["Loggers"] = loggers diff --git a/routers/admin/auths.go b/routers/admin/auths.go index 3cb7a58b..952a5315 100644 --- a/routers/admin/auths.go +++ b/routers/admin/auths.go @@ -9,13 +9,13 @@ import ( "github.com/Unknwon/com" "github.com/go-xorm/core" + log "gopkg.in/clog.v1" "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/auth" "github.com/gogits/gogs/modules/auth/ldap" "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/context" - "github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/setting" ) diff --git a/routers/admin/notice.go b/routers/admin/notice.go index 5d4e807e..5117676f 100644 --- a/routers/admin/notice.go +++ b/routers/admin/notice.go @@ -7,11 +7,11 @@ package admin import ( "github.com/Unknwon/com" "github.com/Unknwon/paginater" + log "gopkg.in/clog.v1" "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/context" - "github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/setting" ) diff --git a/routers/admin/repos.go b/routers/admin/repos.go index 5eacb5ed..11448a3e 100644 --- a/routers/admin/repos.go +++ b/routers/admin/repos.go @@ -5,10 +5,11 @@ package admin import ( + log "gopkg.in/clog.v1" + "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/context" - "github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/routers" ) diff --git a/routers/admin/users.go b/routers/admin/users.go index 8c90b005..6253683b 100644 --- a/routers/admin/users.go +++ b/routers/admin/users.go @@ -8,12 +8,12 @@ import ( "strings" "github.com/Unknwon/com" + log "gopkg.in/clog.v1" "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/auth" "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/context" - "github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/mailer" "github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/routers" diff --git a/routers/api/v1/admin/user.go b/routers/api/v1/admin/user.go index ff2f2c9c..3a3c206d 100644 --- a/routers/api/v1/admin/user.go +++ b/routers/api/v1/admin/user.go @@ -5,11 +5,12 @@ package admin import ( + log "gopkg.in/clog.v1" + api "github.com/gogits/go-gogs-client" "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/context" - "github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/mailer" "github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/routers/api/v1/user" diff --git a/routers/api/v1/repo/repo.go b/routers/api/v1/repo/repo.go index 76d63543..34c162fb 100644 --- a/routers/api/v1/repo/repo.go +++ b/routers/api/v1/repo/repo.go @@ -7,12 +7,13 @@ package repo import ( "path" + log "gopkg.in/clog.v1" + api "github.com/gogits/go-gogs-client" "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/auth" "github.com/gogits/gogs/modules/context" - "github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/routers/api/v1/convert" ) diff --git a/routers/install.go b/routers/install.go index 73b0cb17..742c33a0 100644 --- a/routers/install.go +++ b/routers/install.go @@ -14,6 +14,7 @@ import ( "github.com/Unknwon/com" "github.com/go-xorm/xorm" + log "gopkg.in/clog.v1" "gopkg.in/ini.v1" "gopkg.in/macaron.v1" @@ -24,7 +25,6 @@ import ( "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/context" "github.com/gogits/gogs/modules/cron" - "github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/mailer" "github.com/gogits/gogs/modules/markdown" "github.com/gogits/gogs/modules/setting" @@ -76,7 +76,6 @@ func GlobalInit() { models.InitSyncMirrors() models.InitDeliverHooks() models.InitTestPullRequests() - log.NewGitLogger(path.Join(setting.LogRootPath, "http.log")) } if models.EnableSQLite3 { log.Info("SQLite3 Supported") diff --git a/routers/org/members.go b/routers/org/members.go index 15998aa2..6eade743 100644 --- a/routers/org/members.go +++ b/routers/org/members.go @@ -6,11 +6,11 @@ package org import ( "github.com/Unknwon/com" + log "gopkg.in/clog.v1" "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/context" - "github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/setting" ) diff --git a/routers/org/org.go b/routers/org/org.go index 1a7800d9..1a6a821e 100644 --- a/routers/org/org.go +++ b/routers/org/org.go @@ -5,11 +5,12 @@ package org import ( + log "gopkg.in/clog.v1" + "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/auth" "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/context" - "github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/setting" ) diff --git a/routers/org/setting.go b/routers/org/setting.go index 373e0526..1cd9fc16 100644 --- a/routers/org/setting.go +++ b/routers/org/setting.go @@ -7,11 +7,12 @@ package org import ( "strings" + log "gopkg.in/clog.v1" + "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/auth" "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/context" - "github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/routers/user" ) diff --git a/routers/org/teams.go b/routers/org/teams.go index 3d045642..26d882b8 100644 --- a/routers/org/teams.go +++ b/routers/org/teams.go @@ -8,12 +8,12 @@ import ( "path" "github.com/Unknwon/com" + log "gopkg.in/clog.v1" "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/auth" "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/context" - "github.com/gogits/gogs/modules/log" ) const ( diff --git a/routers/repo/branch.go b/routers/repo/branch.go index 7bc75977..4f32429f 100644 --- a/routers/repo/branch.go +++ b/routers/repo/branch.go @@ -5,11 +5,12 @@ package repo import ( + log "gopkg.in/clog.v1" + "github.com/gogits/git-module" "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/context" - "github.com/gogits/gogs/modules/log" ) const ( diff --git a/routers/repo/editor.go b/routers/repo/editor.go index b1678f68..82a2cb8c 100644 --- a/routers/repo/editor.go +++ b/routers/repo/editor.go @@ -11,12 +11,13 @@ import ( "path" "strings" + log "gopkg.in/clog.v1" + "github.com/gogits/git-module" "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/auth" "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/context" - "github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/modules/template" ) diff --git a/routers/repo/http.go b/routers/repo/http.go index fc83fa87..805b5189 100644 --- a/routers/repo/http.go +++ b/routers/repo/http.go @@ -20,12 +20,13 @@ import ( "strings" "time" + log "gopkg.in/clog.v1" + git "github.com/gogits/git-module" "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/context" - "github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/setting" ) @@ -315,7 +316,7 @@ func gitCommand(dir string, args ...string) []byte { cmd.Dir = dir out, err := cmd.Output() if err != nil { - log.GitLogger.Error(4, fmt.Sprintf("%v - %s", err, out)) + log.Error(4, fmt.Sprintf("Git: %v - %s", err, out)) } return out } @@ -376,7 +377,7 @@ func serviceRPC(h serviceHandler, service string) { if h.r.Header.Get("Content-Encoding") == "gzip" { reqBody, err = gzip.NewReader(reqBody) if err != nil { - log.GitLogger.Error(2, "fail to create gzip reader: %v", err) + log.Error(2, "Git: fail to create gzip reader: %v", err) h.w.WriteHeader(http.StatusInternalServerError) return } @@ -385,7 +386,7 @@ func serviceRPC(h serviceHandler, service string) { if h.cfg.OnSucceed != nil { tmpfile, err := ioutil.TempFile("", "gogs") if err != nil { - log.GitLogger.Error(2, "fail to create temporary file: %v", err) + log.Error(2, "Git: fail to create temporary file: %v", err) h.w.WriteHeader(http.StatusInternalServerError) return } @@ -393,7 +394,7 @@ func serviceRPC(h serviceHandler, service string) { _, err = io.Copy(tmpfile, reqBody) if err != nil { - log.GitLogger.Error(2, "fail to save request body: %v", err) + log.Error(2, "Git: fail to save request body: %v", err) h.w.WriteHeader(http.StatusInternalServerError) return } @@ -402,7 +403,7 @@ func serviceRPC(h serviceHandler, service string) { tmpFilename = tmpfile.Name() tmpfile, err = os.Open(tmpFilename) if err != nil { - log.GitLogger.Error(2, "fail to open temporary file: %v", err) + log.Error(2, "Git: fail to open temporary file: %v", err) h.w.WriteHeader(http.StatusInternalServerError) return } @@ -420,7 +421,7 @@ func serviceRPC(h serviceHandler, service string) { cmd.Stderr = &stderr cmd.Stdin = br if err := cmd.Run(); err != nil { - log.GitLogger.Error(2, "fail to serve RPC(%s): %v - %s", service, err, stderr) + log.Error(2, "Git: fail to serve RPC '%s': %v - %s", service, err, stderr) h.w.WriteHeader(http.StatusInternalServerError) return } @@ -428,7 +429,7 @@ func serviceRPC(h serviceHandler, service string) { if h.cfg.OnSucceed != nil { input, err := os.Open(tmpFilename) if err != nil { - log.GitLogger.Error(2, "fail to open temporary file: %v", err) + log.Error(2, "Git: fail to open temporary file: %v", err) h.w.WriteHeader(http.StatusInternalServerError) return } @@ -545,7 +546,7 @@ func HTTPBackend(ctx *context.Context, cfg *serviceConfig) http.HandlerFunc { file := strings.Replace(r.URL.Path, m[1]+"/", "", 1) dir, err := getGitRepoPath(m[1]) if err != nil { - log.GitLogger.Error(4, err.Error()) + log.Error(4, "Git: getGitRepoPath: %v", err) ctx.Handle(http.StatusNotFound, "HTTPBackend", err) return } diff --git a/routers/repo/issue.go b/routers/repo/issue.go index 0315851a..3884b31c 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -16,12 +16,12 @@ import ( "github.com/Unknwon/com" "github.com/Unknwon/paginater" + log "gopkg.in/clog.v1" "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/auth" "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/context" - "github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/markdown" "github.com/gogits/gogs/modules/setting" ) diff --git a/routers/repo/pull.go b/routers/repo/pull.go index d99d5c83..8aa37bb2 100644 --- a/routers/repo/pull.go +++ b/routers/repo/pull.go @@ -10,6 +10,7 @@ import ( "strings" "github.com/Unknwon/com" + log "gopkg.in/clog.v1" "github.com/gogits/git-module" @@ -17,7 +18,6 @@ import ( "github.com/gogits/gogs/modules/auth" "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/context" - "github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/setting" ) diff --git a/routers/repo/release.go b/routers/repo/release.go index 661aa4e2..f7dd888f 100644 --- a/routers/repo/release.go +++ b/routers/repo/release.go @@ -7,11 +7,12 @@ package repo import ( "fmt" + log "gopkg.in/clog.v1" + "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/auth" "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/context" - "github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/markdown" ) diff --git a/routers/repo/repo.go b/routers/repo/repo.go index 74ee3c4f..8a088c98 100644 --- a/routers/repo/repo.go +++ b/routers/repo/repo.go @@ -11,6 +11,7 @@ import ( "strings" "github.com/Unknwon/com" + log "gopkg.in/clog.v1" "github.com/gogits/git-module" @@ -18,7 +19,6 @@ import ( "github.com/gogits/gogs/modules/auth" "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/context" - "github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/setting" ) diff --git a/routers/repo/setting.go b/routers/repo/setting.go index 01228da8..bcb6dc89 100644 --- a/routers/repo/setting.go +++ b/routers/repo/setting.go @@ -8,13 +8,14 @@ import ( "strings" "time" + log "gopkg.in/clog.v1" + "github.com/gogits/git-module" "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/auth" "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/context" - "github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/mailer" "github.com/gogits/gogs/modules/setting" ) diff --git a/routers/repo/view.go b/routers/repo/view.go index 3e49b3fa..e66575c9 100644 --- a/routers/repo/view.go +++ b/routers/repo/view.go @@ -13,13 +13,13 @@ import ( "strings" "github.com/Unknwon/paginater" + log "gopkg.in/clog.v1" "github.com/gogits/git-module" "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/context" - "github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/markdown" "github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/modules/template" diff --git a/routers/user/auth.go b/routers/user/auth.go index fe1c22fe..7b9f098b 100644 --- a/routers/user/auth.go +++ b/routers/user/auth.go @@ -9,12 +9,12 @@ import ( "net/url" "github.com/go-macaron/captcha" + log "gopkg.in/clog.v1" "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/auth" "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/context" - "github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/mailer" "github.com/gogits/gogs/modules/setting" ) diff --git a/routers/user/setting.go b/routers/user/setting.go index 96e7a09c..717baae8 100644 --- a/routers/user/setting.go +++ b/routers/user/setting.go @@ -11,12 +11,12 @@ import ( "strings" "github.com/Unknwon/com" + log "gopkg.in/clog.v1" "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/auth" "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/context" - "github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/mailer" "github.com/gogits/gogs/modules/setting" ) |