Skip to content

Commit

Permalink
add the necessary log output.
Browse files Browse the repository at this point in the history
  • Loading branch information
eddycjy committed Dec 16, 2018
1 parent cfa5b17 commit 0a007cd
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"fmt"
"log"
"net/http"

"github.com/EDDYCJY/go-gin-example/models"
Expand Down Expand Up @@ -38,6 +39,8 @@ func main() {
MaxHeaderBytes: maxHeaderBytes,
}

log.Printf("[info] start http server listening %s", endPoint)

server.ListenAndServe()

// If you want Graceful Restart, you need a Unix system and download github.com/fvbock/endless
Expand Down
2 changes: 1 addition & 1 deletion models/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func Setup() {
setting.DatabaseSetting.Name))

if err != nil {
log.Println(err)
log.Fatalf("models.Setup err: %v", err)
}

gorm.DefaultTableNameHandler = func(db *gorm.DB, defaultTableName string) string {
Expand Down
2 changes: 1 addition & 1 deletion pkg/logging/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func Setup() {
fileName := getLogFileName()
F, err = file.MustOpen(fileName, filePath)
if err != nil {
log.Fatalln(err)
log.Fatalf("logging.Setup err: %v", err)
}

logger = log.New(F, DefaultPrefix, log.LstdFlags)
Expand Down
2 changes: 1 addition & 1 deletion pkg/setting/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func Setup() {
var err error
cfg, err = ini.Load("conf/app.ini")
if err != nil {
log.Fatalf("Fail to parse 'conf/app.ini': %v", err)
log.Fatalf("setting.Setup, fail to parse 'conf/app.ini': %v", err)
}

mapTo("app", AppSetting)
Expand Down

0 comments on commit 0a007cd

Please sign in to comment.