summaryrefslogtreecommitdiffstats
path: root/update.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2014-03-31 21:26:15 +0800
committerLunny Xiao <xiaolunwen@gmail.com>2014-03-31 21:26:15 +0800
commita187ba96512a49ac7888d87960657ab6ee369a50 (patch)
treebf38225add4f9c9437cb67709ac138ac40994479 /update.go
parent76c64b43cb56a298e5fc2ec8adc0d7b820cbe614 (diff)
downloadgitea-a187ba96512a49ac7888d87960657ab6ee369a50.tar.gz
gitea-a187ba96512a49ac7888d87960657ab6ee369a50.zip
improved log locations
Diffstat (limited to 'update.go')
-rw-r--r--update.go24
1 files changed, 15 insertions, 9 deletions
diff --git a/update.go b/update.go
index e36dc22329..5ccb72fd4f 100644
--- a/update.go
+++ b/update.go
@@ -6,17 +6,19 @@ package main
import (
"container/list"
+ "fmt"
"os"
"os/exec"
+ "path"
"strconv"
"strings"
"github.com/codegangsta/cli"
- //"github.com/gogits/gogs/modules/log"
"github.com/gogits/git"
"github.com/gogits/gogs/models"
"github.com/gogits/gogs/modules/base"
- "github.com/qiniu/log"
+ "github.com/gogits/gogs/modules/log"
+ //"github.com/qiniu/log"
)
var CmdUpdate = cli.Command{
@@ -28,25 +30,29 @@ gogs serv provide access auth for repositories`,
Flags: []cli.Flag{},
}
+func newUpdateLogger(execDir string) {
+ level := "0"
+ logPath := execDir + "/log/update.log"
+ os.MkdirAll(path.Dir(logPath), os.ModePerm)
+ log.NewLogger(0, "file", fmt.Sprintf(`{"level":%s,"filename":"%s"}`, level, logPath))
+ log.Trace("start logging...")
+}
+
// for command: ./gogs update
func runUpdate(c *cli.Context) {
+ execDir, _ := base.ExecDir()
+ newLogger(execDir)
+
base.NewConfigContext()
models.LoadModelsConfig()
if models.UseSQLite3 {
- execDir, _ := base.ExecDir()
os.Chdir(execDir)
}
models.SetEngine()
- w, _ := os.Create("update.log")
- defer w.Close()
-
- log.SetOutput(w)
-
args := c.Args()
- //log.Info(args)
if len(args) != 3 {
log.Error("received less 3 parameters")
return