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
|
package dao
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
|
||||||
"net"
|
"net"
|
||||||
|
|
||||||
|
"github.com/vmware/harbor/utils/log"
|
||||||
|
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
@ -88,7 +89,7 @@ func InitDB() {
|
|||||||
c.Close()
|
c.Close()
|
||||||
ch <- 1
|
ch <- 1
|
||||||
} else {
|
} 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)
|
time.Sleep(2 * time.Second)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
package dao
|
package dao
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
@ -127,7 +126,7 @@ func TestMain(m *testing.M) {
|
|||||||
}
|
}
|
||||||
dbPassword := os.Getenv("DB_PWD")
|
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_ADDR", dbHost)
|
||||||
os.Setenv("MYSQL_PORT_3306_TCP_PORT", dbPort)
|
os.Setenv("MYSQL_PORT_3306_TCP_PORT", dbPort)
|
||||||
|
@ -22,8 +22,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/astaxie/beego"
|
|
||||||
"github.com/astaxie/beego/orm"
|
"github.com/astaxie/beego/orm"
|
||||||
|
"github.com/vmware/harbor/utils/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
//TODO:transaction, return err
|
//TODO:transaction, return err
|
||||||
@ -70,7 +70,7 @@ func AddProject(project models.Project) error {
|
|||||||
func IsProjectPublic(projectName string) bool {
|
func IsProjectPublic(projectName string) bool {
|
||||||
project, err := GetProjectByName(projectName)
|
project, err := GetProjectByName(projectName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
beego.Error("Error occurred in GetProjectByName:", err)
|
log.Errorf("Error occurred in GetProjectByName: %v", err)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if project == nil {
|
if project == nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user