Skip to content

Commit

Permalink
修复log日志bug
Browse files Browse the repository at this point in the history
  • Loading branch information
chanyipiaomiao committed Aug 29, 2018
1 parent 303982d commit 42aeca0
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions common/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import (

"github.com/astaxie/beego"
"github.com/chanyipiaomiao/hltool"
"os"
"path"
"strings"
)

// InitLog 初始化日志
Expand All @@ -15,6 +18,16 @@ func InitLog() {
} else {
logpath = LogPathFromCli
}

var currentDir string
if !strings.HasPrefix(logpath, "/") {
var err error
currentDir, err = os.Getwd()
if err != nil {
log.Fatalf("error: %s", err)
}
}
logpath = path.Join(currentDir, logpath)
hlog, err := hltool.NewHLog(logpath)
if err != nil {
log.Fatalf("error: %s", err)
Expand Down

0 comments on commit 42aeca0

Please sign in to comment.