Browse Source

add log

for-closed-social
Lunny Xiao 10 years ago
parent
commit
48ea9b12f6
2 changed files with 7 additions and 1 deletions
  1. +2
    -0
      models/repo.go
  2. +5
    -1
      serve.go

+ 2
- 0
models/repo.go View File

@ -261,6 +261,7 @@ func initRepository(f string, user *User, repo *Repository, initReadme bool, rep
return err
}
/*
// hook/post-update
pu, err := os.OpenFile(filepath.Join(repoPath, "hooks", "post-update"), os.O_CREATE|os.O_WRONLY, 0777)
if err != nil {
@ -282,6 +283,7 @@ func initRepository(f string, user *User, repo *Repository, initReadme bool, rep
if _, err = pu2.WriteString("#!/usr/bin/env bash\ngit update-server-info\n"); err != nil {
return err
}
*/
// Initialize repository according to user's choice.
fileName := map[string]string{}

+ 5
- 1
serve.go View File

@ -44,6 +44,10 @@ gogs serv provide access auth for repositories`,
Flags: []cli.Flag{},
}
func init() {
log.NewLogger(10000, "file", fmt.Sprintf(`{"filename":"%s"}`, "log/serv.log"))
}
func parseCmd(cmd string) (string, string) {
ss := strings.SplitN(cmd, " ", 2)
if len(ss) != 2 {
@ -227,7 +231,7 @@ func runServ(k *cli.Context) {
return
}
if ref, ok = refs[refname]; !ok {
println("unknow reference name -", refname, "-")
log.Trace("unknow reference name -", refname, "-", b.String())
return
}
l, err = ref.AllCommits()

Loading…
Cancel
Save