Compare commits

...

2 Commits

Author SHA1 Message Date
namhq1989 8a44d79ff0 remove lib color 2022-11-16 09:53:19 +07:00
namhq1989 dfdd151282 remove log whhen start 2022-11-16 09:50:11 +07:00
3 changed files with 3 additions and 13 deletions

5
go.mod
View File

@ -2,7 +2,4 @@ module git.selly.red/Selly-Modules/zookeeper
go 1.16 go 1.16
require ( require github.com/samuel/go-zookeeper v0.0.0-20201211165307-7117e9ea2414
github.com/logrusorgru/aurora v2.0.3+incompatible
github.com/samuel/go-zookeeper v0.0.0-20201211165307-7117e9ea2414
)

2
go.sum
View File

@ -1,4 +1,2 @@
github.com/logrusorgru/aurora v2.0.3+incompatible h1:tOpm7WcpBTn4fjmVfgpQq0EfczGlG91VSDkswnjF5A8=
github.com/logrusorgru/aurora v2.0.3+incompatible/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4=
github.com/samuel/go-zookeeper v0.0.0-20201211165307-7117e9ea2414 h1:AJNDS0kP60X8wwWFvbLPwDuojxubj9pbfK7pjHw0vKg= github.com/samuel/go-zookeeper v0.0.0-20201211165307-7117e9ea2414 h1:AJNDS0kP60X8wwWFvbLPwDuojxubj9pbfK7pjHw0vKg=
github.com/samuel/go-zookeeper v0.0.0-20201211165307-7117e9ea2414/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= github.com/samuel/go-zookeeper v0.0.0-20201211165307-7117e9ea2414/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E=

View File

@ -4,7 +4,6 @@ import (
"fmt" "fmt"
"time" "time"
"github.com/logrusorgru/aurora"
"github.com/samuel/go-zookeeper/zk" "github.com/samuel/go-zookeeper/zk"
) )
@ -12,20 +11,16 @@ var zkClient *zk.Conn
// Connect ... // Connect ...
func Connect(uri string) error { func Connect(uri string) error {
c, _, err := zk.Connect([]string{uri}, time.Second*30) c, _, err := zk.Connect([]string{uri}, time.Second*30, zk.WithLogInfo(false))
if err != nil { if err != nil {
fmt.Println("Error when connect to Zookeeper", uri, err) fmt.Println("Error when connect to Zookeeper", uri, err)
return err return err
} }
fmt.Println(aurora.Green("*** CONNECTED TO ZOOKEEPER: " + uri)) fmt.Printf("⚡️[zookeeper]: connected to %s \n", uri)
// Set client // Set client
zkClient = c zkClient = c
return nil return nil
} }