mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-22 18:25:56 +01:00
logger refactor
This commit is contained in:
parent
f10769d5ba
commit
0812d2870c
@ -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)
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user