logger refactor

This commit is contained in:
Wenkai Yin 2016-03-29 13:33:49 +08:00
parent f10769d5ba
commit 0812d2870c
3 changed files with 6 additions and 6 deletions

View File

@ -16,9 +16,10 @@
package dao
import (
"log"
"net"
"github.com/vmware/harbor/utils/log"
"os"
"strings"
"time"
@ -88,7 +89,7 @@ func InitDB() {
c.Close()
ch <- 1
} else {
log.Printf("failed to connect to db, retry after 2 seconds...")
log.Info("failed to connect to db, retry after 2 seconds...")
time.Sleep(2 * time.Second)
}
}

View File

@ -16,7 +16,6 @@
package dao
import (
"fmt"
"os"
"testing"
"time"
@ -127,7 +126,7 @@ func TestMain(m *testing.M) {
}
dbPassword := os.Getenv("DB_PWD")
fmt.Printf("DB_HOST: %s, DB_USR: %s, DB_PORT: %s, DB_PWD: %s\n", dbHost, dbUser, dbPort, dbPassword)
log.Infof("DB_HOST: %s, DB_USR: %s, DB_PORT: %s, DB_PWD: %s\n", dbHost, dbUser, dbPort, dbPassword)
os.Setenv("MYSQL_PORT_3306_TCP_ADDR", dbHost)
os.Setenv("MYSQL_PORT_3306_TCP_PORT", dbPort)

View File

@ -22,8 +22,8 @@ import (
"fmt"
"time"
"github.com/astaxie/beego"
"github.com/astaxie/beego/orm"
"github.com/vmware/harbor/utils/log"
)
//TODO:transaction, return err
@ -70,7 +70,7 @@ func AddProject(project models.Project) error {
func IsProjectPublic(projectName string) bool {
project, err := GetProjectByName(projectName)
if err != nil {
beego.Error("Error occurred in GetProjectByName:", err)
log.Errorf("Error occurred in GetProjectByName: %v", err)
return false
}
if project == nil {